import time
from .common import InfoExtractor
-from ..compat import compat_str
from ..utils import (
KNOWN_EXTENSIONS,
ExtractorError,
'uploader_id': 'youtube-dl',
'thumbnail': 'https://f4.bcbits.com/img/a3216802731_5.jpg',
},
- '_skip': 'There is a limit of 200 free downloads / month for the test song'
+ '_skip': 'There is a limit of 200 free downloads / month for the test song',
}, {
# free download
'url': 'http://benprunty.bandcamp.com/track/lanius-battle',
def _extract_data_attr(self, webpage, video_id, attr='tralbum', fatal=True):
return self._parse_json(self._html_search_regex(
- r'data-%s=(["\'])({.+?})\1' % attr, webpage,
+ rf'data-{attr}=(["\'])({{.+?}})\1', webpage,
attr + ' data', group=2), video_id, fatal=fatal)
def _real_extract(self, url):
download_link = tralbum.get('freeDownloadPage')
if download_link:
- track_id = compat_str(tralbum['id'])
+ track_id = str(tralbum['id'])
download_webpage = self._download_webpage(
download_link, track_id, 'Downloading free downloads page')
if isinstance(download_formats_list, list):
for f in blob['download_formats']:
name, ext = f.get('name'), f.get('file_extension')
- if all(isinstance(x, compat_str) for x in (name, ext)):
+ if all(isinstance(x, str) for x in (name, ext)):
download_formats[name] = ext.strip('.')
for format_id, f in downloads.items():
})
format_id = f.get('encoding_name') or format_id
stat = self._download_json(
- stat_url, track_id, 'Downloading %s JSON' % format_id,
+ stat_url, track_id, f'Downloading {format_id} JSON',
transform_source=lambda s: s[s.index('{'):s.rindex('}') + 1],
fatal=False)
if not stat:
'acodec': format_id.split('-')[0],
})
- title = '%s - %s' % (artist, track) if artist else track
+ title = f'{artist} - {track}' if artist else track
if not duration:
duration = float_or_none(self._html_search_meta(
'timestamp': 1311756226,
'upload_date': '20110727',
'uploader': 'Blazo',
- }
+ },
},
{
'md5': '1a2c32e2691474643e912cc6cd4bffaa',
'timestamp': 1311757238,
'upload_date': '20110727',
'uploader': 'Blazo',
- }
+ },
},
],
'info_dict': {
'uploader_id': 'blazo',
},
'params': {
- 'playlistend': 2
+ 'playlistend': 2,
},
- 'skip': 'Bandcamp imposes download limits.'
+ 'skip': 'Bandcamp imposes download limits.',
}, {
'url': 'http://nightbringer.bandcamp.com/album/hierophany-of-the-open-grave',
'info_dict': {
def suitable(cls, url):
return (False
if BandcampWeeklyIE.suitable(url) or BandcampIE.suitable(url)
- else super(BandcampAlbumIE, cls).suitable(url))
+ else super().suitable(url))
def _real_extract(self, url):
uploader_id, album_id = self._match_valid_url(url).groups()
},
}, {
'url': 'https://bandcamp.com/?blah/blah@&show=228',
- 'only_matching': True
+ 'only_matching': True,
}]
def _real_extract(self, url):
title = show.get('audio_title') or 'Bandcamp Weekly'
subtitle = show.get('subtitle')
if subtitle:
- title += ' - %s' % subtitle
+ title += f' - {subtitle}'
return {
'id': show_id,
'series': 'Bandcamp Weekly',
'episode': show.get('subtitle'),
'episode_id': show_id,
- 'formats': formats
+ 'formats': formats,
}
'url': 'http://dotscale.bandcamp.com',
'info_dict': {
'id': 'dotscale',
- 'title': 'Discography of dotscale'
+ 'title': 'Discography of dotscale',
},
'playlist_count': 1,
}, {