mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-10 01:02:13 +01:00
[PearVideo] Add fallback for formats (#3438)
Closes #3425 Authored by: hatienl0i261299
This commit is contained in:
parent
7774db5bf9
commit
d14b920c33
1 changed files with 9 additions and 0 deletions
|
@ -4,6 +4,7 @@
|
|||
from ..utils import (
|
||||
qualities,
|
||||
unified_timestamp,
|
||||
traverse_obj,
|
||||
)
|
||||
|
||||
|
||||
|
@ -36,6 +37,14 @@ def _real_extract(self, url):
|
|||
} for mobj in re.finditer(
|
||||
r'(?P<id>[a-zA-Z]+)Url\s*=\s*(["\'])(?P<url>(?:https?:)?//.+?)\2',
|
||||
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)
|
||||
|
||||
title = self._search_regex(
|
||||
|
|
Loading…
Reference in a new issue