diff options
author | Ha Tien Loi <loiht.b17vt220@stu.ptit.edu.vn> | 2022-04-22 20:45:52 +0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-22 06:45:52 -0700 |
commit | d14b920c330b00ca50a66bf471b9f901ebc16212 (patch) | |
tree | 4a5a5c643173878f00829acbf8f8824fddee8f76 | |
parent | 7774db5bf9cb1d3ff1d09f0ba5d431643fdff030 (diff) | |
download | hypervideo-pre-d14b920c330b00ca50a66bf471b9f901ebc16212.tar.lz hypervideo-pre-d14b920c330b00ca50a66bf471b9f901ebc16212.tar.xz hypervideo-pre-d14b920c330b00ca50a66bf471b9f901ebc16212.zip |
[PearVideo] Add fallback for formats (#3438)
Closes #3425
Authored by: hatienl0i261299
-rw-r--r-- | yt_dlp/extractor/pearvideo.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/yt_dlp/extractor/pearvideo.py b/yt_dlp/extractor/pearvideo.py index d552e0966..e76305acd 100644 --- a/yt_dlp/extractor/pearvideo.py +++ b/yt_dlp/extractor/pearvideo.py @@ -4,6 +4,7 @@ from .common import InfoExtractor from ..utils import ( qualities, unified_timestamp, + traverse_obj, ) @@ -36,6 +37,14 @@ class PearVideoIE(InfoExtractor): } 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( |