mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-27 02:42:30 +00:00
[PearVideo] Add fallback for formats (#3438)
Closes #3425 Authored by: hatienl0i261299
This commit is contained in:
parent
7774db5bf9
commit
d14b920c33
@ -4,6 +4,7 @@
|
|||||||
from ..utils import (
|
from ..utils import (
|
||||||
qualities,
|
qualities,
|
||||||
unified_timestamp,
|
unified_timestamp,
|
||||||
|
traverse_obj,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -36,6 +37,14 @@ def _real_extract(self, url):
|
|||||||
} for mobj in re.finditer(
|
} for mobj in re.finditer(
|
||||||
r'(?P<id>[a-zA-Z]+)Url\s*=\s*(["\'])(?P<url>(?:https?:)?//.+?)\2',
|
r'(?P<id>[a-zA-Z]+)Url\s*=\s*(["\'])(?P<url>(?:https?:)?//.+?)\2',
|
||||||
webpage)]
|
webpage)]
|
||||||
|
if not formats:
|
||||||
|
info = self._download_json(
|
||||||
|
'https://www.pearvideo.com/videoStatus.jsp', video_id=video_id,
|
||||||
|
query={'contId': video_id}, headers={'Referer': url})
|
||||||
|
formats = [{
|
||||||
|
'format_id': k,
|
||||||
|
'url': v.replace(info['systemTime'], f'cont-{video_id}') if k == 'srcUrl' else v
|
||||||
|
} for k, v in traverse_obj(info, ('videoInfo', 'videos'), default={}).items() if v]
|
||||||
self._sort_formats(formats)
|
self._sort_formats(formats)
|
||||||
|
|
||||||
title = self._search_regex(
|
title = self._search_regex(
|
||||||
|
Loading…
Reference in New Issue
Block a user