[baidu] Add notes for API calls

pull/8/head
Yen Chi Hsuan 2016-01-02 21:44:49 +08:00
rodzic a1d9f6c5dc
commit 0311677258
1 zmienionych plików z 7 dodań i 4 usunięć

Wyświetl plik

@ -28,8 +28,9 @@ class BaiduVideoIE(InfoExtractor):
'playlist_mincount': 12, 'playlist_mincount': 12,
}] }]
def _call_api(self, path, category, playlist_id): def _call_api(self, path, category, playlist_id, note):
return self._download_json('http://app.video.baidu.com/%s/?worktype=adnative%s&id=%s' % (path, category, playlist_id), playlist_id) return self._download_json('http://app.video.baidu.com/%s/?worktype=adnative%s&id=%s' % (
path, category, playlist_id), playlist_id, note)
def _real_extract(self, url): def _real_extract(self, url):
category, playlist_id = re.match(self._VALID_URL, url).groups() category, playlist_id = re.match(self._VALID_URL, url).groups()
@ -38,12 +39,14 @@ class BaiduVideoIE(InfoExtractor):
if category == 'tv': if category == 'tv':
category = 'tvplay' category = 'tvplay'
playlist_detail = self._call_api('xqinfo', category, playlist_id) playlist_detail = self._call_api(
'xqinfo', category, playlist_id, 'Download playlist JSON metadata')
playlist_title = playlist_detail['title'] playlist_title = playlist_detail['title']
playlist_description = unescapeHTML(playlist_detail.get('intro')) playlist_description = unescapeHTML(playlist_detail.get('intro'))
episodes_detail = self._call_api('xqsingle', category, playlist_id) episodes_detail = self._call_api(
'xqsingle', category, playlist_id, 'Download episodes JSON metadata')
entries = [] entries = []
for episode in episodes_detail['videos']: for episode in episodes_detail['videos']: