mirror of
https://github.com/ytdl-org/youtube-dl
synced 2025-01-22 11:20:10 +09:00
fix some errors in bandlab extractor - test now passes
This commit is contained in:
parent
c673485d4e
commit
8dced09ed0
@ -45,7 +45,7 @@ class BandlabIE(InfoExtractor):
|
|||||||
|
|
||||||
class BandlabAlbumOrPlaylistIE(InfoExtractor):
|
class BandlabAlbumOrPlaylistIE(InfoExtractor):
|
||||||
_VALID_URL = r'https?://(?:www\.)?bandlab\.com/[^/]+/(?P<kind>albums|collections)/(?P<id>[^/]+)'
|
_VALID_URL = r'https?://(?:www\.)?bandlab\.com/[^/]+/(?P<kind>albums|collections)/(?P<id>[^/]+)'
|
||||||
_TRACK_URL_RE = re.compile(r'.+/(?P<id>[^/]+)\.m4a')
|
_TRACK_ID_RE = re.compile(r'.+/(?P<id>[^/]+)\.m4a')
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
'url': 'https://www.bandlab.com/sbsdasani/albums/dc26e307-e51f-ed11-95d7-002248452390',
|
'url': 'https://www.bandlab.com/sbsdasani/albums/dc26e307-e51f-ed11-95d7-002248452390',
|
||||||
'playlist': [
|
'playlist': [
|
||||||
@ -142,7 +142,7 @@ class BandlabAlbumOrPlaylistIE(InfoExtractor):
|
|||||||
kind_regex = re.compile(self._VALID_URL)
|
kind_regex = re.compile(self._VALID_URL)
|
||||||
kind = kind_regex.match(url).group('kind')
|
kind = kind_regex.match(url).group('kind')
|
||||||
config = self._download_json(
|
config = self._download_json(
|
||||||
'http://www.bandlab.com/api/v1.3/%s/%s' % kind, resource_id)
|
'http://www.bandlab.com/api/v1.3/%s/%s' % (kind, resource_id), resource_id)
|
||||||
entries = []
|
entries = []
|
||||||
for track in try_get(config, lambda x: x['posts'], list) or []:
|
for track in try_get(config, lambda x: x['posts'], list) or []:
|
||||||
url, name = try_get(
|
url, name = try_get(
|
||||||
@ -154,16 +154,16 @@ class BandlabAlbumOrPlaylistIE(InfoExtractor):
|
|||||||
name = strip_or_none(name)
|
name = strip_or_none(name)
|
||||||
if not (url and name):
|
if not (url and name):
|
||||||
continue
|
continue
|
||||||
id = self._TRACK_ID_RE.match(url).groupdict().get('id')
|
track_id = self._TRACK_ID_RE.match(url).groupdict().get('id')
|
||||||
if not id:
|
if not track_id:
|
||||||
continue
|
continue
|
||||||
entries.append({
|
entries.append({
|
||||||
'url': url,
|
'url': url,
|
||||||
'id': self._TRACK_URL_RE.match(url).group('id'),
|
'id': track_id,
|
||||||
'title': name
|
'title': name
|
||||||
})
|
})
|
||||||
|
|
||||||
res = {
|
return {
|
||||||
'_type': 'playlist',
|
'_type': 'playlist',
|
||||||
'id': resource_id,
|
'id': resource_id,
|
||||||
'entries': entries,
|
'entries': entries,
|
||||||
|
@ -98,7 +98,7 @@ from .azmedien import AZMedienIE
|
|||||||
from .baidu import BaiduVideoIE
|
from .baidu import BaiduVideoIE
|
||||||
from .bandaichannel import BandaiChannelIE
|
from .bandaichannel import BandaiChannelIE
|
||||||
from .bandcamp import BandcampIE, BandcampAlbumIE, BandcampWeeklyIE
|
from .bandcamp import BandcampIE, BandcampAlbumIE, BandcampWeeklyIE
|
||||||
from .bandlab import BandlabIE, BandlabAlbumIE, BandlabPlaylistIE
|
from .bandlab import BandlabIE, BandlabAlbumOrPlaylistIE
|
||||||
from .bbc import (
|
from .bbc import (
|
||||||
BBCCoUkIE,
|
BBCCoUkIE,
|
||||||
BBCCoUkArticleIE,
|
BBCCoUkArticleIE,
|
||||||
|
Loading…
Reference in New Issue
Block a user