From d6b19dca91dd4404becb9ee583e632f13423c5e2 Mon Sep 17 00:00:00 2001 From: npayne Date: Sat, 28 Jan 2023 18:13:12 -0500 Subject: [PATCH] bandlab nits --- youtube_dl/extractor/bandlab.py | 10 ++++------ youtube_dl/extractor/extractors.py | 5 ++++- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/youtube_dl/extractor/bandlab.py b/youtube_dl/extractor/bandlab.py index bb06251ba..2cfb711e2 100644 --- a/youtube_dl/extractor/bandlab.py +++ b/youtube_dl/extractor/bandlab.py @@ -45,7 +45,7 @@ class BandlabIE(InfoExtractor): class BandlabAlbumOrPlaylistIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?bandlab\.com/[^/]+/(?Palbums|collections)/(?P[^/]+)' - _TRACK_ID_RE = re.compile(r'.+/(?P[^/]+)\.m4a') + _TRACK_ID_RE = r'.+/(?P[^/]+)\.m4a' _TESTS = [{ 'url': 'https://www.bandlab.com/sbsdasani/albums/dc26e307-e51f-ed11-95d7-002248452390', 'playlist': [ @@ -138,9 +138,7 @@ class BandlabAlbumOrPlaylistIE(InfoExtractor): }] def _real_extract(self, url): - resource_id = self._match_id(url) - kind_regex = re.compile(self._VALID_URL) - kind = kind_regex.match(url).group('kind') + resource_id, kind = re.match(self._VALID_URL, url).group('id', 'kind') config = self._download_json( 'http://www.bandlab.com/api/v1.3/%s/%s' % (kind, resource_id), resource_id) entries = [] @@ -154,13 +152,13 @@ class BandlabAlbumOrPlaylistIE(InfoExtractor): name = strip_or_none(name) if not (url and name): continue - track_id = self._TRACK_ID_RE.match(url).groupdict().get('id') + track_id = re.match(self._TRACK_ID_RE, url).group('id') if not track_id: continue entries.append({ 'url': url, 'id': track_id, - 'title': name + 'title': name, }) return { diff --git a/youtube_dl/extractor/extractors.py b/youtube_dl/extractor/extractors.py index a1327fb8c..ea0c3a0b8 100644 --- a/youtube_dl/extractor/extractors.py +++ b/youtube_dl/extractor/extractors.py @@ -98,7 +98,10 @@ from .azmedien import AZMedienIE from .baidu import BaiduVideoIE from .bandaichannel import BandaiChannelIE from .bandcamp import BandcampIE, BandcampAlbumIE, BandcampWeeklyIE -from .bandlab import BandlabIE, BandlabAlbumOrPlaylistIE +from .bandlab import ( + BandlabIE, + BandlabAlbumOrPlaylistIE +) from .bbc import ( BBCCoUkIE, BBCCoUkArticleIE,