aboutsummaryrefslogtreecommitdiffstats
path: root/hypervideo_dl/extractor/bandcamp.py
diff options
context:
space:
mode:
authorJesús <heckyel@hyperbola.info>2021-10-18 15:24:21 -0500
committerJesús <heckyel@hyperbola.info>2021-10-18 15:24:21 -0500
commit5122028a4bcac4ae577ef7fbd55ccad5cb34ef5e (patch)
tree65209bc739db35e31f1c9b5b868eb5df4fe12ae3 /hypervideo_dl/extractor/bandcamp.py
parent27fe903c511691c078942bef5ee9a05a43b15c8f (diff)
downloadhypervideo-5122028a4bcac4ae577ef7fbd55ccad5cb34ef5e.tar.lz
hypervideo-5122028a4bcac4ae577ef7fbd55ccad5cb34ef5e.tar.xz
hypervideo-5122028a4bcac4ae577ef7fbd55ccad5cb34ef5e.zip
update from upstream
Diffstat (limited to 'hypervideo_dl/extractor/bandcamp.py')
-rw-r--r--hypervideo_dl/extractor/bandcamp.py48
1 files changed, 44 insertions, 4 deletions
diff --git a/hypervideo_dl/extractor/bandcamp.py b/hypervideo_dl/extractor/bandcamp.py
index dbe57c7..b664145 100644
--- a/hypervideo_dl/extractor/bandcamp.py
+++ b/hypervideo_dl/extractor/bandcamp.py
@@ -31,9 +31,9 @@ class BandcampIE(InfoExtractor):
'info_dict': {
'id': '1812978515',
'ext': 'mp3',
- 'title': "hypervideo \"'/\\ä↭ - hypervideo \"'/\\ä↭ - hypervideo test song \"'/\\ä↭",
+ 'title': "youtube-dl \"'/\\ä↭ - youtube-dl \"'/\\ä↭ - youtube-dl test song \"'/\\ä↭",
'duration': 9.8485,
- 'uploader': 'hypervideo "\'/\\ä↭',
+ 'uploader': 'youtube-dl "\'/\\ä↭',
'upload_date': '20121129',
'timestamp': 1354224127,
},
@@ -212,7 +212,7 @@ class BandcampIE(InfoExtractor):
class BandcampAlbumIE(BandcampIE):
IE_NAME = 'Bandcamp:album'
- _VALID_URL = r'https?://(?:(?P<subdomain>[^.]+)\.)?bandcamp\.com(?:/album/(?P<id>[^/?#&]+))?'
+ _VALID_URL = r'https?://(?:(?P<subdomain>[^.]+)\.)?bandcamp\.com(?!/music)(?:/album/(?P<id>[^/?#&]+))?'
_TESTS = [{
'url': 'http://blazo.bandcamp.com/album/jazz-format-mixtape-vol-1',
@@ -294,7 +294,7 @@ class BandcampAlbumIE(BandcampIE):
else super(BandcampAlbumIE, cls).suitable(url))
def _real_extract(self, url):
- uploader_id, album_id = re.match(self._VALID_URL, url).groups()
+ uploader_id, album_id = self._match_valid_url(url).groups()
playlist_id = album_id or uploader_id
webpage = self._download_webpage(url, playlist_id)
tralbum = self._extract_data_attr(webpage, playlist_id)
@@ -389,3 +389,43 @@ class BandcampWeeklyIE(BandcampIE):
'episode_id': show_id,
'formats': formats
}
+
+
+class BandcampMusicIE(InfoExtractor):
+ _VALID_URL = r'https?://(?P<id>[^/]+)\.bandcamp\.com/music'
+ _TESTS = [{
+ 'url': 'https://steviasphere.bandcamp.com/music',
+ 'playlist_mincount': 47,
+ 'info_dict': {
+ 'id': 'steviasphere',
+ },
+ }, {
+ 'url': 'https://coldworldofficial.bandcamp.com/music',
+ 'playlist_mincount': 10,
+ 'info_dict': {
+ 'id': 'coldworldofficial',
+ },
+ }, {
+ 'url': 'https://nuclearwarnowproductions.bandcamp.com/music',
+ 'playlist_mincount': 399,
+ 'info_dict': {
+ 'id': 'nuclearwarnowproductions',
+ },
+ }
+ ]
+
+ _TYPE_IE_DICT = {
+ 'album': BandcampAlbumIE.ie_key(),
+ 'track': BandcampIE.ie_key()
+ }
+
+ def _real_extract(self, url):
+ id = self._match_id(url)
+ webpage = self._download_webpage(url, id)
+ items = re.findall(r'href\=\"\/(?P<path>(?P<type>album|track)+/[^\"]+)', webpage)
+ entries = [
+ self.url_result(
+ f'https://{id}.bandcamp.com/{item[0]}',
+ ie=self._TYPE_IE_DICT[item[1]])
+ for item in items]
+ return self.playlist_result(entries, id)