1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2024-11-05 02:32:44 +01:00

[SovietsCloset] Fix playlists for games with only named categories

Authored by: ConquerorDopy
This commit is contained in:
ChillingPepper 2021-09-22 04:10:02 +02:00 committed by GitHub
parent d806c9fd97
commit f6d8776d34
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -167,6 +167,14 @@ class SovietsClosetPlaylistIE(SovietsClosetBaseIE):
},
'playlist_mincount': 3,
},
{
'url': 'https://sovietscloset.com/Total-War-Warhammer',
'info_dict': {
'id': 'Total-War-Warhammer',
'title': 'Total War: Warhammer - Greenskins',
},
'playlist_mincount': 33,
},
]
def _real_extract(self, url):
@ -188,7 +196,9 @@ def _real_extract(self, url):
category_slug = 'misc'
game = next(game for game in sovietscloset if game['slug'].lower() == game_slug)
category = next(cat for cat in game['subcategories'] if cat['slug'].lower() == category_slug)
category = next((cat for cat in game['subcategories'] if cat.get('slug', '').lower() == category_slug),
game['subcategories'][0])
category_slug = category.get('slug', '').lower() or category_slug
playlist_title = game.get('name') or game_slug
if category_slug != 'misc':
playlist_title += f' - {category.get("name") or category_slug}'