1 from .common
import InfoExtractor
2 from ..utils
import unescapeHTML
5 class BaiduVideoIE(InfoExtractor
):
7 _VALID_URL
= r
'https?://v\.baidu\.com/(?P<type>[a-z]+)/(?P<id>\d+)\.htm'
9 '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',
12 'title': '中华小当家 TV版国语',
13 'description': 'md5:51be07afe461cf99fa61231421b5397c',
17 'url': 'http://v.baidu.com/show/11595.htm?frp=bdbrand',
21 'description': 'md5:1bf88bad6d850930f542d51547c089b8',
23 'playlist_mincount': 12,
26 def _call_api(self
, path
, category
, playlist_id
, note
):
27 return self
._download
_json
(
28 f
'http://app.video.baidu.com/{path}/?worktype=adnative{category}&id={playlist_id}',
31 def _real_extract(self
, url
):
32 category
, playlist_id
= self
._match
_valid
_url
(url
).groups()
33 if category
== 'show':
38 playlist_detail
= self
._call
_api
(
39 'xqinfo', category
, playlist_id
, 'Download playlist JSON metadata')
41 playlist_title
= playlist_detail
['title']
42 playlist_description
= unescapeHTML(playlist_detail
.get('intro'))
44 episodes_detail
= self
._call
_api
(
45 'xqsingle', category
, playlist_id
, 'Download episodes JSON metadata')
47 entries
= [self
.url_result(
48 episode
['url'], video_title
=episode
['title'],
49 ) for episode
in episodes_detail
['videos']]
51 return self
.playlist_result(
52 entries
, playlist_id
, playlist_title
, playlist_description
)