1
0
mirror of https://codeberg.org/polarisfm/youtube-dl synced 2025-01-23 21:17:55 +01:00

[tver] fix the code pointed out in flake8

This commit is contained in:
tsukumijima 2020-09-22 04:17:54 +09:00
parent 9f45837753
commit e57602b380

View File

@ -1,19 +1,9 @@
# coding: utf-8 # coding: utf-8
from __future__ import unicode_literals from __future__ import unicode_literals
import csv
import re import re
from .common import InfoExtractor
from .brightcove import BrightcoveNewIE from .brightcove import BrightcoveNewIE
from ..compat import (
compat_HTTPError,
)
from ..utils import (
ExtractorError,
js_to_json,
unsmuggle_url,
)
class TVerIE(BrightcoveNewIE): class TVerIE(BrightcoveNewIE):
@ -119,15 +109,22 @@ class TVerIE(BrightcoveNewIE):
# get video information # get video information
info_dict = super(TVerIE, self)._real_extract(brightcove_url) info_dict = super(TVerIE, self)._real_extract(brightcove_url)
# get video description
description = \
self._og_search_description(webpage) or \
self._html_search_meta('twitter:description', webpage) or \
self._html_search_regex(r'<div class="description">(?P<description>.*?)</div>', webpage, 'description', default=None, flags=re.DOTALL)
# undo _VALID_URL # undo _VALID_URL
self._VALID_URL = _VALID_URL self._VALID_URL = _VALID_URL
# replacement # TVer ID
info_dict['id'] = video_id # TVer ID info_dict['id'] = video_id
info_dict['display_id'] = brightcove_video_id # Brightcove ID # Brightcove ID
info_dict['thumbnail'] = info_dict['thumbnail'].replace('160x90', '1920x1080') # select large thumbnail info_dict['display_id'] = brightcove_video_id
info_dict['description'] = self._html_search_regex( # desctiption # select large thumbnail
r'<div class="description">(?P<description>.*?)</div>', info_dict['thumbnail'] = info_dict['thumbnail'].replace('160x90', '1920x1080')
webpage, 'description', flags=re.DOTALL) # desctiption
info_dict['description'] = description
return info_dict return info_dict