未验证 提交 d14b920c 编写于 作者: H Ha Tien Loi 提交者: GitHub

[PearVideo] Add fallback for formats (#3438)

Closes #3425
Authored by: hatienl0i261299
上级 7774db5b
......@@ -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(
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册