[soundcloud:pagedplaylist] Add ie and title to entries (#19022)

rel: https://github.com/rg3/youtube-dl/issues/19022
This commit is contained in:
Cory Hall 2019-01-31 20:51:37 -05:00 committed by Sergey M․
parent b9bc1cff72
commit 6cc6e0c34d
No known key found for this signature in database
GPG key ID: 2C393E0F18A9236D

View file

@ -395,18 +395,20 @@ 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 resolve_permalink_url(candidates): def append_url_result(entries, item):
for cand in candidates: for cand in (item, item.get('track'), item.get('playlist')):
if isinstance(cand, dict): if isinstance(cand, dict):
permalink_url = cand.get('permalink_url') permalink_url = cand.get('permalink_url')
entry_id = self._extract_id(cand)
if permalink_url and permalink_url.startswith('http'): if permalink_url and permalink_url.startswith('http'):
return permalink_url, entry_id return entries.append(
self.url_result(
permalink_url,
ie=SoundcloudIE.ie_key() if SoundcloudIE.suitable(permalink_url) else None,
video_id=self._extract_id(cand),
video_title=cand.get('title')))
for e in collection: for e in collection:
permalink_url, entry_id = resolve_permalink_url((e, e.get('track'), e.get('playlist'))) append_url_result(entries, e)
if permalink_url:
entries.append(self.url_result(permalink_url, video_id=entry_id))
next_href = response.get('next_href') next_href = response.get('next_href')
if not next_href: if not next_href: