1
0
mirror of https://codeberg.org/polarisfm/youtube-dl synced 2024-11-25 18:04:33 +01:00

Update BandcampUser extractor to match the webpage changes

This commit is contained in:
Lyz 2020-04-07 20:46:15 +02:00
parent d897244f05
commit 5cdb5b2842
No known key found for this signature in database
GPG Key ID: 6C7D7C1612CDE02F

View File

@ -419,7 +419,7 @@ class BandcampUserIE(InfoExtractor):
'id': 'adrianvonziegler', 'id': 'adrianvonziegler',
'title': 'Discography of adrianvonziegler', 'title': 'Discography of adrianvonziegler',
}, },
'playlist_mincount': 22, 'playlist_mincount': 23,
}, { }, {
'url': 'http://dotscale.bandcamp.com', 'url': 'http://dotscale.bandcamp.com',
'info_dict': { 'info_dict': {
@ -451,23 +451,25 @@ class BandcampUserIE(InfoExtractor):
entries = [] entries = []
# Bandcamp User type 1 page # Bandcamp User type 1 page
try: discography_data = re.findall(
discography_data = json.loads(self._search_regex( r'<li data-item-id="([^"]+)[^>]+>\s*<a href="(/[^/]+/[^/"]+)">',
r'data-edit-callback="/music_reorder" data-initial-values="([^"]+)">', webpage, re.MULTILINE)
webpage, 'raw_data').replace('&quot;', '"'))
for element in discography_data: if len(discography_data) > 0:
if element['type'] == 'album': for match in discography_data:
element_id = match[0]
element_url = match[1]
if element_url.split('/')[1] == 'album':
ie = BandcampAlbumIE.ie_key() ie = BandcampAlbumIE.ie_key()
else: else:
ie = BandcampIE.ie_key() ie = BandcampIE.ie_key()
entries.append(self.url_result( entries.append(self.url_result(
compat_urlparse.urljoin(url, element['page_url']), compat_urlparse.urljoin(url, element_url),
ie=ie, ie=ie,
video_id=str(element['id']), video_id=element_id,
video_title=element['title'])) video_title=element_url.split('/')[2]))
except RegexNotFoundError: else:
# Bandcamp user type 2 page # Bandcamp user type 2 page
discography_data = re.findall( discography_data = re.findall(
r'<div[^>]+trackTitle["\'][^"\']+["\']([^"\']+)', webpage) r'<div[^>]+trackTitle["\'][^"\']+["\']([^"\']+)', webpage)