[mixcloud:playlist:base] Fix video id extraction in flat playlist mode (refs #27787)
authorSergey M․ <dstftw@gmail.com>
Sat, 16 Jan 2021 02:42:11 +0000 (09:42 +0700)
committerSergey M․ <dstftw@gmail.com>
Sat, 16 Jan 2021 02:42:57 +0000 (09:42 +0700)
youtube_dl/extractor/mixcloud.py

index 37f16a791fae90a20df36700ce3b7c8f14922b76..69319857dfb872fee9137d78cd89c433d812a594 100644 (file)
@@ -251,11 +251,9 @@ class MixcloudPlaylistBaseIE(MixcloudBaseIE):
                 cloudcast_url = cloudcast.get('url')
                 if not cloudcast_url:
                     continue
-                video_id = cloudcast.get('slug')
-                if video_id:
-                    owner_username = try_get(cloudcast, lambda x: x['owner']['username'], compat_str)
-                    if owner_username:
-                        video_id = '%s_%s' % (owner_username, video_id)
+                slug = try_get(cloudcast, lambda x: x['slug'], compat_str)
+                owner_username = try_get(cloudcast, lambda x: x['owner']['username'], compat_str)
+                video_id = '%s_%s' % (owner_username, slug) if slug and owner_username else None
                 entries.append(self.url_result(
                     cloudcast_url, MixcloudIE.ie_key(), video_id))