mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-12-13 14:37:43 +01:00
[soundcloud:pagedplaylist] Improve (closes #19086)
This commit is contained in:
parent
6cc6e0c34d
commit
7c5307f4c4
@ -18,6 +18,7 @@
|
|||||||
int_or_none,
|
int_or_none,
|
||||||
unified_strdate,
|
unified_strdate,
|
||||||
update_url_query,
|
update_url_query,
|
||||||
|
url_or_none,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -395,20 +396,23 @@ def _extract_playlist(self, base_url, playlist_id, playlist_title):
|
|||||||
# Empty collection may be returned, in this case we proceed
|
# Empty collection may be returned, in this case we proceed
|
||||||
# straight to next_href
|
# straight to next_href
|
||||||
|
|
||||||
def append_url_result(entries, item):
|
def resolve_entry(candidates):
|
||||||
for cand in (item, item.get('track'), item.get('playlist')):
|
for cand in candidates:
|
||||||
if isinstance(cand, dict):
|
if not isinstance(cand, dict):
|
||||||
permalink_url = cand.get('permalink_url')
|
continue
|
||||||
if permalink_url and permalink_url.startswith('http'):
|
permalink_url = url_or_none(cand.get('permalink_url'))
|
||||||
return entries.append(
|
if not permalink_url:
|
||||||
self.url_result(
|
continue
|
||||||
permalink_url,
|
return self.url_result(
|
||||||
ie=SoundcloudIE.ie_key() if SoundcloudIE.suitable(permalink_url) else None,
|
permalink_url,
|
||||||
video_id=self._extract_id(cand),
|
ie=SoundcloudIE.ie_key() if SoundcloudIE.suitable(permalink_url) else None,
|
||||||
video_title=cand.get('title')))
|
video_id=self._extract_id(cand),
|
||||||
|
video_title=cand.get('title'))
|
||||||
|
|
||||||
for e in collection:
|
for e in collection:
|
||||||
append_url_result(entries, e)
|
entry = resolve_entry((e, e.get('track'), e.get('playlist')))
|
||||||
|
if entry:
|
||||||
|
entries.append(entry)
|
||||||
|
|
||||||
next_href = response.get('next_href')
|
next_href = response.get('next_href')
|
||||||
if not next_href:
|
if not next_href:
|
||||||
|
Loading…
Reference in New Issue
Block a user