1
0
mirror of https://codeberg.org/polarisfm/youtube-dl synced 2025-01-08 14:17:54 +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
from __future__ import unicode_literals
import csv
import re
from .common import InfoExtractor
from .brightcove import BrightcoveNewIE
from ..compat import (
compat_HTTPError,
)
from ..utils import (
ExtractorError,
js_to_json,
unsmuggle_url,
)
class TVerIE(BrightcoveNewIE):
@ -119,15 +109,22 @@ class TVerIE(BrightcoveNewIE):
# get video information
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
self._VALID_URL = _VALID_URL
# replacement
info_dict['id'] = video_id # TVer ID
info_dict['display_id'] = brightcove_video_id # Brightcove ID
info_dict['thumbnail'] = info_dict['thumbnail'].replace('160x90', '1920x1080') # select large thumbnail
info_dict['description'] = self._html_search_regex( # desctiption
r'<div class="description">(?P<description>.*?)</div>',
webpage, 'description', flags=re.DOTALL)
# TVer ID
info_dict['id'] = video_id
# Brightcove ID
info_dict['display_id'] = brightcove_video_id
# select large thumbnail
info_dict['thumbnail'] = info_dict['thumbnail'].replace('160x90', '1920x1080')
# desctiption
info_dict['description'] = description
return info_dict