mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-12-02 11:26:41 +00:00
[duboku] fix list results, minor error checking
This commit is contained in:
parent
7cc9d5b321
commit
bf7392922f
|
@ -101,7 +101,7 @@ def _real_extract(self, url):
|
||||||
|
|
||||||
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 @@ def _real_extract(self, url):
|
||||||
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 @@ def _real_extract(self, url):
|
||||||
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 @@ def _real_extract(self, url):
|
||||||
# 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