[extractor/bandcamp] Extract uploader_url

Closes #4755
This commit is contained in:
pukkandan 2022-09-02 01:38:21 +05:30
parent 7c6eb424d3
commit 2c475e48b5
No known key found for this signature in database
GPG key ID: 7EEE9E1E817D0A39

View file

@ -21,7 +21,7 @@
class BandcampIE(InfoExtractor): class BandcampIE(InfoExtractor):
_VALID_URL = r'https?://[^/]+\.bandcamp\.com/track/(?P<id>[^/?#&]+)' _VALID_URL = r'https?://(?P<uploader>[^/]+)\.bandcamp\.com/track/(?P<id>[^/?#&]+)'
_EMBED_REGEX = [r'<meta property="og:url"[^>]*?content="(?P<url>.*?bandcamp\.com.*?)"'] _EMBED_REGEX = [r'<meta property="og:url"[^>]*?content="(?P<url>.*?bandcamp\.com.*?)"']
_TESTS = [{ _TESTS = [{
'url': 'http://youtube-dl.bandcamp.com/track/youtube-dl-test-song', 'url': 'http://youtube-dl.bandcamp.com/track/youtube-dl-test-song',
@ -85,7 +85,7 @@ def _extract_data_attr(self, webpage, video_id, attr='tralbum', fatal=True):
attr + ' data', group=2), video_id, fatal=fatal) attr + ' data', group=2), video_id, fatal=fatal)
def _real_extract(self, url): def _real_extract(self, url):
title = self._match_id(url) title, uploader = self._match_valid_url(url).group('id', 'uploader')
webpage = self._download_webpage(url, title) webpage = self._download_webpage(url, title)
tralbum = self._extract_data_attr(webpage, title) tralbum = self._extract_data_attr(webpage, title)
thumbnail = self._og_search_thumbnail(webpage) thumbnail = self._og_search_thumbnail(webpage)
@ -197,6 +197,8 @@ def _real_extract(self, url):
'title': title, 'title': title,
'thumbnail': thumbnail, 'thumbnail': thumbnail,
'uploader': artist, 'uploader': artist,
'uploader_id': uploader,
'uploader_url': f'https://{uploader}.bandcamp.com',
'timestamp': timestamp, 'timestamp': timestamp,
'release_timestamp': unified_timestamp(tralbum.get('album_release_date')), 'release_timestamp': unified_timestamp(tralbum.get('album_release_date')),
'duration': duration, 'duration': duration,