]>
jfr.im git - yt-dlp.git/blob - youtube_dl/extractor/baidu.py
2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
9 class BaiduVideoIE(InfoExtractor
):
11 _VALID_URL
= r
'http://v\.baidu\.com/(?P<type>[a-z]+)/(?P<id>\d+)\.htm'
13 'url': 'http://v.baidu.com/comic/1069.htm?frp=bdbrand&q=%E4%B8%AD%E5%8D%8E%E5%B0%8F%E5%BD%93%E5%AE%B6',
16 'title': '中华小当家 TV版国语',
17 'description': 'md5:40a9c1b1c7f4e05d642e7bb1c84eeda0',
21 'url': 'http://v.baidu.com/show/11595.htm?frp=bdbrand',
25 'description': 'md5:1bf88bad6d850930f542d51547c089b8',
27 'playlist_mincount': 12,
30 def _call_api(self
, path
, category
, playlist_id
):
31 return self
._download
_json
('http://app.video.baidu.com/%s/?worktype=adnative%s&id=%s' % (path
, category
, playlist_id
), playlist_id
)
33 def _real_extract(self
, url
):
34 category
, playlist_id
= re
.match(self
._VALID
_URL
, url
).groups()
35 if category
== 'show':
40 playlist_detail
= self
._call
_api
('xqinfo', category
, playlist_id
)
42 playlist_title
= playlist_detail
['title']
43 playlist_description
= playlist_detail
.get('intro')
45 episodes_detail
= self
._call
_api
('xqsingle', category
, playlist_id
)
48 for episode
in episodes_detail
['videos']:
49 entries
.append(self
.url_result(
50 episode
['url'], video_title
=episode
['title']))
52 return self
.playlist_result(
53 entries
, playlist_id
, playlist_title
, playlist_description
)