1
0
Fork 0
mirror of https://gitlab.com/dstftw/youtube-dl.git synced 2020-11-16 09:42:26 +00:00

[youku] Fix list extraction.(close #15135) (#15137)

* [youku] Fix list extraction.(close #15135)

Change-Id: I2e9c920143f4f16012252625943a8f18b8ff40eb

* [youku] Remove KeyError try-except

Change-Id: Ic46327905cbef1356b7b12d5eb3db5d9746ca338
This commit is contained in:
JianxinLi 2018-01-04 22:25:28 +08:00 committed by Chih-Hsuan Yen
parent de329f64ab
commit da35331c6c

View file

@ -245,13 +245,19 @@ class YoukuShowIE(InfoExtractor):
# No data-id value. # No data-id value.
'url': 'http://list.youku.com/show/id_zefbfbd61237fefbfbdef.html', 'url': 'http://list.youku.com/show/id_zefbfbd61237fefbfbdef.html',
'only_matching': True, 'only_matching': True,
}, {
# Wrong number of reload_id.
'url': 'http://list.youku.com/show/id_z20eb4acaf5c211e3b2ad.html',
'only_matching': True,
}] }]
def _extract_entries(self, playlist_data_url, show_id, note, query): def _extract_entries(self, playlist_data_url, show_id, note, query):
query['callback'] = 'cb' query['callback'] = 'cb'
playlist_data = self._download_json( playlist_data = self._download_json(
playlist_data_url, show_id, query=query, note=note, playlist_data_url, show_id, query=query, note=note,
transform_source=lambda s: js_to_json(strip_jsonp(s)))['html'] transform_source=lambda s: js_to_json(strip_jsonp(s))).get('html')
if playlist_data is None:
return [None, None]
drama_list = (get_element_by_class('p-drama-grid', playlist_data) or drama_list = (get_element_by_class('p-drama-grid', playlist_data) or
get_element_by_class('p-drama-half-row', playlist_data)) get_element_by_class('p-drama-half-row', playlist_data))
if drama_list is None: if drama_list is None:
@ -291,8 +297,8 @@ class YoukuShowIE(InfoExtractor):
'id': page_config['showid'], 'id': page_config['showid'],
'stage': reload_id, 'stage': reload_id,
}) })
if new_entries is not None:
entries.extend(new_entries) entries.extend(new_entries)
desc = self._html_search_meta('description', webpage, fatal=False) desc = self._html_search_meta('description', webpage, fatal=False)
playlist_title = desc.split(',')[0] if desc else None playlist_title = desc.split(',')[0] if desc else None
detail_li = get_element_by_class('p-intro', webpage) detail_li = get_element_by_class('p-intro', webpage)