1
0
mirror of https://codeberg.org/polarisfm/youtube-dl synced 2024-11-29 19:47:54 +01:00

flake8 fixes

This commit is contained in:
Scott 2020-05-22 15:58:01 -04:00
parent 6c787d8f1e
commit 47f777b1c3

View File

@ -4,18 +4,13 @@ from __future__ import unicode_literals
import re import re
from .common import InfoExtractor from .common import InfoExtractor
from ..compat import compat_str
from ..utils import ( from ..utils import (
ExtractorError, ExtractorError,
determine_ext, determine_ext,
int_or_none, int_or_none,
float_or_none,
js_to_json, js_to_json,
orderedSet, orderedSet,
strip_jsonp,
strip_or_none,
unified_strdate, unified_strdate,
url_or_none,
US_RATINGS, US_RATINGS,
) )
@ -76,18 +71,15 @@ class PBSKIDSIE(InfoExtractor):
if episode_id: if episode_id:
webpage = self._download_webpage(url, episode_id) webpage = self._download_webpage(url, episode_id)
description = self._html_search_meta( description = self._html_search_meta(
'description', webpage, default=None) 'description', webpage, default=None)
upload_date = unified_strdate(self._search_regex( upload_date = unified_strdate(self._search_regex(
r'air_date"\:"([^"]+)"', r'air_date"\:"([^"]+)"',
webpage, 'upload date', default=None)) webpage, 'upload date', default=None))
# m3u8 url # m3u8 url
MULTI_PART_REGEXES = ( MULTI_PART_REGEXES = (
r'URI"\:"https?\:.?/.?/urs\.pbs\.org.?/redirect.?/([\d\w]+)', r'URI"\:"https?\:.?/.?/urs\.pbs\.org.?/redirect.?/([\d\w]+)',
) )
for p in MULTI_PART_REGEXES: for p in MULTI_PART_REGEXES:
tabbed_videos = orderedSet(re.findall(p, webpage)) tabbed_videos = orderedSet(re.findall(p, webpage))
if tabbed_videos: if tabbed_videos:
@ -97,7 +89,7 @@ class PBSKIDSIE(InfoExtractor):
page = self._download_webpage(url, 0) page = self._download_webpage(url, 0)
data = self._extract_video_data(page, 'video data', 0) data = self._extract_video_data(page, 'video data', 0)
info = data.get('video_obj') info = data.get('video_obj')
video_id = info.get('URI').replace('https://urs.pbs.org/redirect/','').replace('/','') video_id = info.get('URI').replace('https://urs.pbs.org/redirect/', '').replace('/', '')
display_id = data.get('video_id') display_id = data.get('video_id')
return video_id, display_id, None, description, info return video_id, display_id, None, description, info
@ -119,7 +111,7 @@ class PBSKIDSIE(InfoExtractor):
return self.playlist_result(entries, display_id) return self.playlist_result(entries, display_id)
redirects = [] redirects = []
redirects.append({"url":'https://urs.pbs.org/redirect/%s/' % video_id, 'eeid':display_id}) redirects.append({"url": 'https://urs.pbs.org/redirect/%s/' % video_id, 'eeid': display_id})
if upload_date is None: if upload_date is None:
upload_date = unified_strdate(info.get('air_date')) upload_date = unified_strdate(info.get('air_date'))
@ -191,7 +183,7 @@ class PBSKIDSIE(InfoExtractor):
age_limit = US_RATINGS.get(rating_str) age_limit = US_RATINGS.get(rating_str)
subtitles = {} subtitles = {}
closed_captions_url = info.get('closed_captions')[0].get('URI').replace('\\','') closed_captions_url = info.get('closed_captions')[0].get('URI').replace('\\', '')
if closed_captions_url: if closed_captions_url:
subtitles['en'] = [{ subtitles['en'] = [{
'ext': 'ttml', 'ext': 'ttml',
@ -231,5 +223,4 @@ class PBSKIDSIE(InfoExtractor):
'upload_date': upload_date, 'upload_date': upload_date,
'formats': formats, 'formats': formats,
'subtitles': subtitles, 'subtitles': subtitles,
#'chapters': chapters,
} }