mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2025-07-18 03:08:31 +00:00
Merge ace97a88fa
into c1ac543c81
This commit is contained in:
commit
aab8367ce0
@ -11,10 +11,12 @@
|
|||||||
float_or_none,
|
float_or_none,
|
||||||
int_or_none,
|
int_or_none,
|
||||||
parse_filesize,
|
parse_filesize,
|
||||||
|
smuggle_url,
|
||||||
str_or_none,
|
str_or_none,
|
||||||
try_get,
|
try_get,
|
||||||
unified_strdate,
|
unified_strdate,
|
||||||
unified_timestamp,
|
unified_timestamp,
|
||||||
|
unsmuggle_url,
|
||||||
update_url_query,
|
update_url_query,
|
||||||
url_or_none,
|
url_or_none,
|
||||||
urljoin,
|
urljoin,
|
||||||
@ -127,6 +129,8 @@ 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):
|
||||||
|
url, smuggled_track_info = unsmuggle_url(url, None)
|
||||||
|
|
||||||
title, uploader = self._match_valid_url(url).group('id', 'uploader')
|
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)
|
||||||
@ -138,7 +142,7 @@ def _real_extract(self, url):
|
|||||||
duration = None
|
duration = None
|
||||||
|
|
||||||
formats = []
|
formats = []
|
||||||
track_info = try_get(tralbum, lambda x: x['trackinfo'][0], dict)
|
track_info = try_get(tralbum, lambda x: x['trackinfo'][0], dict) or smuggled_track_info
|
||||||
if track_info:
|
if track_info:
|
||||||
file_ = track_info.get('file')
|
file_ = track_info.get('file')
|
||||||
if isinstance(file_, dict):
|
if isinstance(file_, dict):
|
||||||
@ -347,6 +351,15 @@ class BandcampAlbumIE(BandcampIE): # XXX: Do not subclass from concrete IE
|
|||||||
'description': 'md5:b3cf845ee41b2b1141dc7bde9237255f',
|
'description': 'md5:b3cf845ee41b2b1141dc7bde9237255f',
|
||||||
},
|
},
|
||||||
'playlist_count': 2,
|
'playlist_count': 2,
|
||||||
|
}, {
|
||||||
|
# tracks need track_info smuggled because they don't have a usable one on the pages
|
||||||
|
'url': 'https://wetleg.bandcamp.com/album/wet-leg',
|
||||||
|
'info_dict': {
|
||||||
|
'id': 'wet-leg',
|
||||||
|
'title': 'Wet Leg',
|
||||||
|
'uploader_id': 'wetleg',
|
||||||
|
},
|
||||||
|
'playlist_count': 12,
|
||||||
}]
|
}]
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@ -364,12 +377,17 @@ def _real_extract(self, url):
|
|||||||
if not track_info:
|
if not track_info:
|
||||||
raise ExtractorError('The page doesn\'t contain any tracks')
|
raise ExtractorError('The page doesn\'t contain any tracks')
|
||||||
# Only tracks with duration info have songs
|
# Only tracks with duration info have songs
|
||||||
entries = [
|
entries = []
|
||||||
self.url_result(
|
for t in track_info:
|
||||||
urljoin(url, t['title_link']), BandcampIE.ie_key(),
|
if t.get('duration'):
|
||||||
str_or_none(t.get('track_id') or t.get('id')), t.get('title'))
|
url = urljoin(url, t['title_link'])
|
||||||
for t in track_info
|
if t.get('track_license_id'):
|
||||||
if t.get('duration')]
|
# tracks with this set don't have a usable tralbum on their pages
|
||||||
|
url = smuggle_url(url, t)
|
||||||
|
entries.append(self.url_result(
|
||||||
|
url, BandcampIE.ie_key(),
|
||||||
|
str_or_none(t.get('track_id') or t.get('id')), t.get('title'),
|
||||||
|
))
|
||||||
|
|
||||||
current = tralbum.get('current') or {}
|
current = tralbum.get('current') or {}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user