[puhutv] update for url_or_none
This commit is contained in:
parent
681ab939b2
commit
330751897f
@ -8,6 +8,7 @@ from ..utils import (
|
|||||||
float_or_none,
|
float_or_none,
|
||||||
determine_ext,
|
determine_ext,
|
||||||
str_or_none,
|
str_or_none,
|
||||||
|
url_or_none,
|
||||||
unified_strdate,
|
unified_strdate,
|
||||||
unified_timestamp,
|
unified_timestamp,
|
||||||
try_get,
|
try_get,
|
||||||
@ -87,7 +88,7 @@ class PuhuTVIE(InfoExtractor):
|
|||||||
thumbnails = []
|
thumbnails = []
|
||||||
thumbs_dict = try_get(info, lambda x: x['content']['images']['wide'], dict) or {}
|
thumbs_dict = try_get(info, lambda x: x['content']['images']['wide'], dict) or {}
|
||||||
for id, url in thumbs_dict.items():
|
for id, url in thumbs_dict.items():
|
||||||
if not url or not isinstance(url, compat_str):
|
if not url_or_none(url):
|
||||||
continue
|
continue
|
||||||
thumbnails.append({
|
thumbnails.append({
|
||||||
'url': 'https://%s' % url,
|
'url': 'https://%s' % url,
|
||||||
@ -99,8 +100,8 @@ class PuhuTVIE(InfoExtractor):
|
|||||||
if not isinstance(subtitle, dict):
|
if not isinstance(subtitle, dict):
|
||||||
continue
|
continue
|
||||||
lang = subtitle.get('language')
|
lang = subtitle.get('language')
|
||||||
sub_url = subtitle.get('url')
|
sub_url = url_or_none(subtitle.get('url'))
|
||||||
if not lang or not isinstance(lang, compat_str) or not sub_url or not isinstance(sub_url, compat_str):
|
if not lang or not isinstance(lang, compat_str) or not sub_url:
|
||||||
continue
|
continue
|
||||||
subtitles[self._SUBTITLE_LANGS.get(lang, lang)] = [{
|
subtitles[self._SUBTITLE_LANGS.get(lang, lang)] = [{
|
||||||
'url': sub_url
|
'url': sub_url
|
||||||
@ -113,8 +114,8 @@ class PuhuTVIE(InfoExtractor):
|
|||||||
|
|
||||||
formats = []
|
formats = []
|
||||||
for format in req_formats['data']['videos']:
|
for format in req_formats['data']['videos']:
|
||||||
media_url = format.get('url')
|
media_url = url_or_none(format.get('url'))
|
||||||
if not media_url or not isinstance(media_url, compat_str):
|
if not media_url:
|
||||||
continue
|
continue
|
||||||
ext = format.get('video_format') or determine_ext(media_url)
|
ext = format.get('video_format') or determine_ext(media_url)
|
||||||
quality = format.get('quality')
|
quality = format.get('quality')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user