1 from .common
import InfoExtractor
10 class XinpianchangIE(InfoExtractor
):
11 _VALID_URL
= r
'https?://(www\.)?xinpianchang\.com/(?P<id>a\d+)'
14 'url': 'https://www.xinpianchang.com/a11766551',
18 'title': '北京2022冬奥会闭幕式再见短片-冰墩墩下班了',
19 'description': 'md5:4a730c10639a82190fabe921c0fa4b87',
21 'thumbnail': r
're:^https?://oss-xpc0\.xpccdn\.com.+/assets/',
23 'uploader_id': '10357277',
24 'categories': ['宣传片', '国家城市', '广告', '其他'],
25 'tags': ['北京冬奥会', '冰墩墩', '再见', '告别', '冰墩墩哭了', '感动', '闭幕式', '熄火'],
28 'url': 'https://www.xinpianchang.com/a11762904',
32 'title': '冬奥会决胜时刻《法国派出三只鸡?》',
33 'description': 'md5:55cb139ef8f48f0c877932d1f196df8b',
35 'thumbnail': r
're:^https?://oss-xpc0\.xpccdn\.com.+/assets/',
37 'uploader_id': '10858927',
38 'categories': ['动画', '三维CG'],
39 'tags': ['France Télévisions', '法国3台', '蠢萌', '冬奥会'],
42 'url': 'https://www.xinpianchang.com/a11779743?from=IndexPick&part=%E7%BC%96%E8%BE%91%E7%B2%BE%E9%80%89&index=2',
43 'only_matching': True,
46 def _real_extract(self
, url
):
47 video_id
= self
._match
_id
(url
)
48 webpage
= self
._download
_webpage
(url
, video_id
=video_id
)
49 video_data
= self
._search
_nextjs
_data
(webpage
, video_id
)['props']['pageProps']['detail']['video']
51 data
= self
._download
_json
(
52 f
'https://mod-api.xinpianchang.com/mod/api/v2/media/{video_data["vid"]}', video_id
,
53 query
={'appKey': video_data
['appKey']})['data']
54 formats
, subtitles
= [], {}
55 for k
, v
in data
.get('resource').items():
56 if k
in ('dash', 'hls'):
61 fmts
, subs
= self
._extract
_mpd
_formats
_and
_subtitles
(v_url
, video_id
=video_id
)
63 fmts
, subs
= self
._extract
_m
3u8_formats
_and
_subtitles
(v_url
, video_id
=video_id
)
65 subtitles
= self
._merge
_subtitles
(subtitles
, subs
)
66 elif k
== 'progressive':
68 'url': url_or_none(prog
.get('url')),
69 'width': int_or_none(prog
.get('width')),
70 'height': int_or_none(prog
.get('height')),
73 # NB: Server returns 403 without the Range header
76 } for prog
in v
if prog
.get('url') or []])
80 'title': data
.get('title'),
81 'description': data
.get('description'),
82 'duration': int_or_none(data
.get('duration')),
83 'categories': data
.get('categories'),
84 'tags': data
.get('keywords'),
85 'thumbnail': data
.get('cover'),
86 'uploader': try_get(data
, lambda x
: x
['owner']['username']),
87 'uploader_id': str_or_none(try_get(data
, lambda x
: x
['owner']['id'])),
89 'subtitles': subtitles
,