mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-11-16 06:15:46 +00:00
[duboku] fix list results, minor error checking
This commit is contained in:
parent
7cc9d5b321
commit
bf7392922f
1 changed files with 7 additions and 5 deletions
|
@ -101,7 +101,7 @@ class DubokuIE(InfoExtractor):
|
||||||
|
|
||||||
player_data = self._search_regex(
|
player_data = self._search_regex(
|
||||||
self._PLAYER_DATA_PATTERN, webpage_html, 'player_data')
|
self._PLAYER_DATA_PATTERN, webpage_html, 'player_data')
|
||||||
player_data = self._parse_json(js_to_json(player_data), video_id)
|
player_data = self._parse_json(player_data, video_id, js_to_json)
|
||||||
|
|
||||||
# extract title
|
# extract title
|
||||||
|
|
||||||
|
@ -121,8 +121,9 @@ class DubokuIE(InfoExtractor):
|
||||||
title = re.sub(r'[\s\r\n\t]+', ' ', title)
|
title = re.sub(r'[\s\r\n\t]+', ' ', title)
|
||||||
break
|
break
|
||||||
|
|
||||||
data_url = player_data['url']
|
data_url = player_data.get('url')
|
||||||
assert data_url
|
if not data_url:
|
||||||
|
raise ExtractorError('Cannot find url in player_data')
|
||||||
data_from = player_data.get('from')
|
data_from = player_data.get('from')
|
||||||
|
|
||||||
# if it is an embedded iframe, maybe it's an external source
|
# if it is an embedded iframe, maybe it's an external source
|
||||||
|
@ -225,7 +226,7 @@ class DubokuPlaylistIE(InfoExtractor):
|
||||||
playlist = playlists.get(fragment)
|
playlist = playlists.get(fragment)
|
||||||
playlist_id = fragment
|
playlist_id = fragment
|
||||||
else:
|
else:
|
||||||
first = next(iter(playlists.items()))
|
first = next(iter(playlists.items()), None)
|
||||||
if first:
|
if first:
|
||||||
(playlist_id, playlist) = first
|
(playlist_id, playlist) = first
|
||||||
if not playlist:
|
if not playlist:
|
||||||
|
@ -235,5 +236,6 @@ class DubokuPlaylistIE(InfoExtractor):
|
||||||
# return url results
|
# return url results
|
||||||
return self.playlist_result([
|
return self.playlist_result([
|
||||||
self.url_result(
|
self.url_result(
|
||||||
'https://www.duboku.co' + x['href'], DubokuIE.IE_NAME, video_title=x.get('title'))
|
compat_urlparse.urljoin('https://www.duboku.co', x['href']),
|
||||||
|
ie=DubokuIE.ie_key(), video_title=x.get('title'))
|
||||||
for x in playlist], series_id + '#' + playlist_id, title)
|
for x in playlist], series_id + '#' + playlist_id, title)
|
||||||
|
|
Loading…
Reference in a new issue