[ie/wistia] Support password-protected videos (#11100)
[yt-dlp3.git] / yt_dlp / extractor / discogs.py
blob048c62288ca481707054bfb5c0d216a9dc33652e
1 from .common import InfoExtractor
2 from .youtube import YoutubeIE
3 from ..utils import traverse_obj
6 class DiscogsReleasePlaylistIE(InfoExtractor):
7 _VALID_URL = r'https?://(?:www\.)?discogs\.com/(?P<type>release|master)/(?P<id>\d+)'
8 _TESTS = [{
9 'url': 'https://www.discogs.com/release/1-The-Persuader-Stockholm',
10 'info_dict': {
11 'id': 'release1',
12 'title': 'Stockholm',
14 'playlist_mincount': 7,
15 }, {
16 'url': 'https://www.discogs.com/master/113-Vince-Watson-Moments-In-Time',
17 'info_dict': {
18 'id': 'master113',
19 'title': 'Moments In Time',
21 'playlist_mincount': 53,
24 def _real_extract(self, url):
25 playlist_id, playlist_type = self._match_valid_url(url).group('id', 'type')
27 display_id = f'{playlist_type}{playlist_id}'
28 response = self._download_json(
29 f'https://api.discogs.com/{playlist_type}s/{playlist_id}', display_id)
31 entries = [
32 self.url_result(video['uri'], YoutubeIE, video_title=video.get('title'))
33 for video in traverse_obj(response, ('videos', lambda _, v: YoutubeIE.suitable(v['uri'])))]
35 return self.playlist_result(entries, display_id, response.get('title'))