[ie/twitter:spaces] Support video spaces (#10789)
[yt-dlp3.git] / yt_dlp / extractor / reverbnation.py
blobddf8c3753fdcb184a90ba8a5b8f8c40fde728feb
1 from .common import InfoExtractor
2 from ..utils import (
3 qualities,
4 str_or_none,
8 class ReverbNationIE(InfoExtractor):
9 _VALID_URL = r'^https?://(?:www\.)?reverbnation\.com/.*?/song/(?P<id>\d+).*?$'
10 _TESTS = [{
11 'url': 'http://www.reverbnation.com/alkilados/song/16965047-mona-lisa',
12 'md5': 'c0aaf339bcee189495fdf5a8c8ba8645',
13 'info_dict': {
14 'id': '16965047',
15 'ext': 'mp3',
16 'title': 'MONA LISA',
17 'uploader': 'ALKILADOS',
18 'uploader_id': '216429',
19 'thumbnail': r're:^https?://.*\.jpg',
23 def _real_extract(self, url):
24 song_id = self._match_id(url)
26 api_res = self._download_json(
27 f'https://api.reverbnation.com/song/{song_id}',
28 song_id,
29 note=f'Downloading information of song {song_id}',
32 THUMBNAILS = ('thumbnail', 'image')
33 quality = qualities(THUMBNAILS)
34 thumbnails = []
35 for thumb_key in THUMBNAILS:
36 if api_res.get(thumb_key):
37 thumbnails.append({
38 'url': api_res[thumb_key],
39 'preference': quality(thumb_key),
42 return {
43 'id': song_id,
44 'title': api_res['name'],
45 'url': api_res['url'],
46 'uploader': api_res.get('artist', {}).get('name'),
47 'uploader_id': str_or_none(api_res.get('artist', {}).get('id')),
48 'thumbnails': thumbnails,
49 'ext': 'mp3',
50 'vcodec': 'none',