mirror of https://github.com/yt-dlp/yt-dlp.git
[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 .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(
|
||||
|
|
Loading…
Reference in New Issue