[ie/twitter:spaces] Support video spaces (#10789)
[yt-dlp3.git] / yt_dlp / extractor / qingting.py
blob74fecee1fa500a4069002c220ad81dfce2329520
1 from .common import InfoExtractor
2 from ..utils import traverse_obj
5 class QingTingIE(InfoExtractor):
6 _VALID_URL = r'https?://(?:www\.|m\.)?(?:qingting\.fm|qtfm\.cn)/v?channels/(?P<channel>\d+)/programs/(?P<id>\d+)'
7 _TESTS = [{
8 'url': 'https://www.qingting.fm/channels/378005/programs/22257411/',
9 'md5': '47e6a94f4e621ed832c316fd1888fb3c',
10 'info_dict': {
11 'id': '22257411',
12 'title': '用了十年才修改,谁在乎教科书?',
13 'channel_id': '378005',
14 'channel': '睡前消息',
15 'uploader': '马督工',
16 'ext': 'm4a',
18 }, {
19 'url': 'https://m.qtfm.cn/vchannels/378005/programs/23023573/',
20 'md5': '2703120b6abe63b5fa90b975a58f4c0e',
21 'info_dict': {
22 'id': '23023573',
23 'title': '【睡前消息488】重庆山火之后,有图≠真相',
24 'channel_id': '378005',
25 'channel': '睡前消息',
26 'uploader': '马督工',
27 'ext': 'm4a',
31 def _real_extract(self, url):
32 channel_id, pid = self._match_valid_url(url).group('channel', 'id')
33 webpage = self._download_webpage(
34 f'https://m.qtfm.cn/vchannels/{channel_id}/programs/{pid}/', pid)
35 info = self._search_json(r'window\.__initStores\s*=', webpage, 'program info', pid)
36 return {
37 'id': pid,
38 'title': traverse_obj(info, ('ProgramStore', 'programInfo', 'title')),
39 'channel_id': channel_id,
40 'channel': traverse_obj(info, ('ProgramStore', 'channelInfo', 'title')),
41 'uploader': traverse_obj(info, ('ProgramStore', 'podcasterInfo', 'podcaster', 'nickname')),
42 'url': traverse_obj(info, ('ProgramStore', 'programInfo', 'audioUrl')),
43 'vcodec': 'none',
44 'acodec': 'm4a',
45 'ext': 'm4a',