mirror of
https://github.com/ytdl-org/youtube-dl
synced 2025-07-15 16:04:13 +09:00
Compare commits
4 Commits
d870fc5960
...
14872b36c8
Author | SHA1 | Date | |
---|---|---|---|
![]() |
14872b36c8 | ||
![]() |
da7223d4aa | ||
![]() |
37c2440d6a | ||
![]() |
45ecff5db0 |
@ -232,8 +232,32 @@ _NSIG_TESTS = [
|
||||
'W9HJZKktxuYoDTqW', 'jHbbkcaxm54',
|
||||
),
|
||||
(
|
||||
'https://www.youtube.com/s/player/91201489/player_ias_tce.vflset/en_US/base.js',
|
||||
'W9HJZKktxuYoDTqW', 'U48vOZHaeYS6vO',
|
||||
'https://www.youtube.com/s/player/643afba4/player_ias.vflset/en_US/base.js',
|
||||
'W9HJZKktxuYoDTqW', 'larxUlagTRAcSw',
|
||||
),
|
||||
(
|
||||
'https://www.youtube.com/s/player/e7567ecf/player_ias_tce.vflset/en_US/base.js',
|
||||
'Sy4aDGc0VpYRR9ew_', '5UPOT1VhoZxNLQ',
|
||||
),
|
||||
(
|
||||
'https://www.youtube.com/s/player/d50f54ef/player_ias_tce.vflset/en_US/base.js',
|
||||
'Ha7507LzRmH3Utygtj', 'XFTb2HoeOE5MHg',
|
||||
),
|
||||
(
|
||||
'https://www.youtube.com/s/player/074a8365/player_ias_tce.vflset/en_US/base.js',
|
||||
'Ha7507LzRmH3Utygtj', 'ufTsrE0IVYrkl8v',
|
||||
),
|
||||
(
|
||||
'https://www.youtube.com/s/player/643afba4/player_ias.vflset/en_US/base.js',
|
||||
'N5uAlLqm0eg1GyHO', 'dCBQOejdq5s-ww',
|
||||
),
|
||||
(
|
||||
'https://www.youtube.com/s/player/69f581a5/tv-player-ias.vflset/tv-player-ias.js',
|
||||
'-qIP447rVlTTwaZjY', 'KNcGOksBAvwqQg',
|
||||
),
|
||||
(
|
||||
'https://www.youtube.com/s/player/643afba4/tv-player-ias.vflset/tv-player-ias.js',
|
||||
'ir9-V6cdbCiyKxhr', '2PL7ZDYAALMfmA',
|
||||
),
|
||||
]
|
||||
|
||||
|
191
youtube_dl/extractor/bandlab.py
Normal file
191
youtube_dl/extractor/bandlab.py
Normal file
@ -0,0 +1,191 @@
|
||||
# coding: utf-8
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from .common import InfoExtractor
|
||||
|
||||
from ..utils import (
|
||||
ExtractorError,
|
||||
merge_dicts,
|
||||
T,
|
||||
traverse_obj,
|
||||
txt_or_none,
|
||||
url_or_none,
|
||||
)
|
||||
|
||||
|
||||
class BandlabIE(InfoExtractor):
|
||||
_VALID_URL = r'https?://(?:www\.)?bandlab\.com/post/(?P<id>[^/]+)'
|
||||
|
||||
_TESTS = [{
|
||||
'url': 'https://www.bandlab.com/post/f117c6d9-9b14-ef11-96f5-000d3a425266',
|
||||
'info_dict': {
|
||||
'id': 'f117c6d9-9b14-ef11-96f5-000d3a425266',
|
||||
'ext': 'm4a',
|
||||
'title': 'essentials',
|
||||
'artist': 'Nico Tranquility',
|
||||
},
|
||||
}]
|
||||
|
||||
def _real_extract(self, url):
|
||||
track_id = self._match_id(url)
|
||||
config = self._download_json(
|
||||
'http://www.bandlab.com/api/v1.3/posts/%s' % track_id, track_id)
|
||||
track_url = traverse_obj(config, ('revision', 'mixdown', 'file', T(url_or_none)))
|
||||
if not track_url:
|
||||
raise ExtractorError(
|
||||
'[%s] No video formats found!' % (self.ie_key(), ),
|
||||
video_id=track_id, expected=True)
|
||||
title = traverse_obj(config, ('revision', 'song', 'name', T(txt_or_none)))
|
||||
|
||||
return {
|
||||
'id': track_id,
|
||||
'title': title,
|
||||
'url': track_url,
|
||||
'artist': traverse_obj(config, ('creator', 'name', T(txt_or_none))),
|
||||
}
|
||||
|
||||
|
||||
class BandlabAlbumOrPlaylistIE(InfoExtractor):
|
||||
_VALID_URL = r'https?://(?:www\.)?bandlab\.com/[^/]+/(?P<kind>albums|collections)/(?P<id>[^/]+)'
|
||||
_TESTS = [{
|
||||
'url': 'https://www.bandlab.com/nicoeskasenuatrans/albums/a7f108ca-74d6-ee11-85f9-00224845a8e0',
|
||||
'playlist': [
|
||||
{
|
||||
"info_dict": {
|
||||
"id": "d30b09de-2320-4fc3-a778-c2cb8a01baf7",
|
||||
"title": "self made",
|
||||
"ext": "m4a"
|
||||
}
|
||||
},
|
||||
{
|
||||
"info_dict": {
|
||||
"id": "2b08f655-7ae5-407c-afbb-f0d6f5dec4ed",
|
||||
"title": "pride",
|
||||
"ext": "m4a"
|
||||
}
|
||||
},
|
||||
{
|
||||
"info_dict": {
|
||||
"id": "03259a33-613a-4e2b-a784-0cf67e82886a",
|
||||
"title": "free speech",
|
||||
"ext": "m4a"
|
||||
}
|
||||
},
|
||||
{
|
||||
"info_dict": {
|
||||
"id": "5264bf91-9700-4603-9a78-c40d2aee2a56",
|
||||
"title": "legalize insanity",
|
||||
"ext": "m4a"
|
||||
}
|
||||
},
|
||||
{
|
||||
"info_dict": {
|
||||
"id": "a32c22f5-945c-4bb5-91d6-3419f96b92bf",
|
||||
"title": "euphoria",
|
||||
"ext": "m4a"
|
||||
}
|
||||
},
|
||||
{
|
||||
"info_dict": {
|
||||
"id": "df065a3c-a36d-4e6e-81a8-c2b94204b1c6",
|
||||
"title": "true colours (more euphoria)",
|
||||
"ext": "m4a"
|
||||
}
|
||||
},
|
||||
{
|
||||
"info_dict": {
|
||||
"id": "e0bf4b18-deb2-4a09-99e2-07d45bcc9c1e",
|
||||
"title": "manifest",
|
||||
"ext": "m4a"
|
||||
}
|
||||
},
|
||||
{
|
||||
"info_dict": {
|
||||
"id": "a6b0c087-8980-4699-954b-7ee0376be7f6",
|
||||
"title": "survivor's guilt",
|
||||
"ext": "m4a"
|
||||
}
|
||||
},
|
||||
{
|
||||
"info_dict": {
|
||||
"id": "19b80025-6557-43d5-85b9-cd9f6075f27e",
|
||||
"title": "memories",
|
||||
"ext": "m4a"
|
||||
}
|
||||
},
|
||||
{
|
||||
"info_dict": {
|
||||
"id": "ff6a0fdf-afb5-40d0-902f-1f1760b74c75",
|
||||
"title": "it gets better",
|
||||
"ext": "m4a"
|
||||
}
|
||||
},
|
||||
{
|
||||
"info_dict": {
|
||||
"id": "12e77b89-43e6-42ef-b1c9-f7551f108f16",
|
||||
"title": "undeletable",
|
||||
"ext": "m4a"
|
||||
}
|
||||
},
|
||||
{
|
||||
"info_dict": {
|
||||
"id": "f2b959bf-4014-4c5d-8079-3f6d0b9ca5b9",
|
||||
"title": "antifascientist",
|
||||
"ext": "m4a"
|
||||
}
|
||||
}
|
||||
],
|
||||
'info_dict': {
|
||||
'id': 'a7f108ca-74d6-ee11-85f9-00224845a8e0',
|
||||
'album': 'trans*',
|
||||
'artist': 'Nico Tranquility'
|
||||
},
|
||||
}, {
|
||||
'url': 'https://www.bandlab.com/hexatetrahedronx/collections/8fb1041c-e865-eb11-9889-0050f28a2802',
|
||||
'playlist': [
|
||||
{
|
||||
'info_dict': {
|
||||
'id': '8f37e4aa-92c4-eb11-a7ad-0050f280467f',
|
||||
'title': 'psych ward',
|
||||
'ext': 'm4a'
|
||||
}
|
||||
}
|
||||
],
|
||||
'info_dict': {
|
||||
'id': '8fb1041c-e865-eb11-9889-0050f28a2802',
|
||||
'album': 'DOOMTAPE',
|
||||
'artist': '12days'
|
||||
}
|
||||
}]
|
||||
|
||||
def _real_extract(self, url):
|
||||
resource_id, kind = self._match_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 = []
|
||||
for track in traverse_obj(config, ('posts', Ellipsis)):
|
||||
url, name = (traverse_obj(track, ('track', {
|
||||
'url': ('sample', 'audioUrl', T(url_or_none)),
|
||||
'name': ('name', T(txt_or_none)),
|
||||
}), ('revision', {
|
||||
'url': ('mixdown', 'file', T(url_or_none)),
|
||||
'name': ('song', 'name', T(txt_or_none)),
|
||||
})).get(x) for x in ('url', 'name'))
|
||||
if not (url and name):
|
||||
continue
|
||||
track_id = self._search_regex(
|
||||
r'/([^/]+)\.m4a$', url, 'track id', default=None)
|
||||
if not track_id:
|
||||
continue
|
||||
entries.append({
|
||||
'url': url,
|
||||
'id': track_id,
|
||||
'title': name,
|
||||
})
|
||||
|
||||
return merge_dicts(
|
||||
self.playlist_result(entries, playlist_id=resource_id),
|
||||
traverse_obj(config, {
|
||||
'album': ('name', T(txt_or_none)),
|
||||
'artist': ('creator', 'name', T(txt_or_none)),
|
||||
}))
|
@ -98,6 +98,7 @@ from .azmedien import AZMedienIE
|
||||
from .baidu import BaiduVideoIE
|
||||
from .bandaichannel import BandaiChannelIE
|
||||
from .bandcamp import BandcampIE, BandcampAlbumIE, BandcampWeeklyIE
|
||||
from .bandlab import BandlabIE, BandlabAlbumOrPlaylistIE
|
||||
from .bbc import (
|
||||
BBCCoUkIE,
|
||||
BBCCoUkArticleIE,
|
||||
|
@ -91,12 +91,12 @@ class YoutubeBaseInfoExtractor(InfoExtractor):
|
||||
'INNERTUBE_CONTEXT': {
|
||||
'client': {
|
||||
'clientName': 'IOS',
|
||||
'clientVersion': '19.45.4',
|
||||
'clientVersion': '20.10.4',
|
||||
'deviceMake': 'Apple',
|
||||
'deviceModel': 'iPhone16,2',
|
||||
'userAgent': 'com.google.ios.youtube/19.45.4 (iPhone16,2; U; CPU iOS 18_1_0 like Mac OS X;)',
|
||||
'userAgent': 'com.google.ios.youtube/20.10.4 (iPhone16,2; U; CPU iOS 18_3_2 like Mac OS X;)',
|
||||
'osName': 'iPhone',
|
||||
'osVersion': '18.1.0.22B83',
|
||||
'osVersion': '18.3.2.22D82',
|
||||
},
|
||||
},
|
||||
'INNERTUBE_CONTEXT_CLIENT_NAME': 5,
|
||||
@ -109,7 +109,7 @@ class YoutubeBaseInfoExtractor(InfoExtractor):
|
||||
'INNERTUBE_CONTEXT': {
|
||||
'client': {
|
||||
'clientName': 'MWEB',
|
||||
'clientVersion': '2.20241202.07.00',
|
||||
'clientVersion': '2.20250311.03.00',
|
||||
# mweb previously did not require PO Token with this UA
|
||||
'userAgent': 'Mozilla/5.0 (iPad; CPU OS 16_7_10 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.6 Mobile/15E148 Safari/604.1,gzip(gfe)',
|
||||
},
|
||||
@ -122,7 +122,7 @@ class YoutubeBaseInfoExtractor(InfoExtractor):
|
||||
'INNERTUBE_CONTEXT': {
|
||||
'client': {
|
||||
'clientName': 'TVHTML5',
|
||||
'clientVersion': '7.20250120.19.00',
|
||||
'clientVersion': '7.20250312.16.00',
|
||||
'userAgent': 'Mozilla/5.0 (ChromiumStylePlatform) Cobalt/Version',
|
||||
},
|
||||
},
|
||||
@ -133,7 +133,7 @@ class YoutubeBaseInfoExtractor(InfoExtractor):
|
||||
'INNERTUBE_CONTEXT': {
|
||||
'client': {
|
||||
'clientName': 'WEB',
|
||||
'clientVersion': '2.20241126.01.00',
|
||||
'clientVersion': '2.20250312.04.00',
|
||||
},
|
||||
},
|
||||
'INNERTUBE_CONTEXT_CLIENT_NAME': 1,
|
||||
@ -692,7 +692,7 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
|
||||
'invidious': '|'.join(_INVIDIOUS_SITES),
|
||||
}
|
||||
_PLAYER_INFO_RE = (
|
||||
r'/s/player/(?P<id>[a-zA-Z0-9_-]{8,})/player',
|
||||
r'/s/player/(?P<id>[a-zA-Z0-9_-]{8,})//(?:tv-)?player',
|
||||
r'/(?P<id>[a-zA-Z0-9_-]{8,})/player(?:_ias\.vflset(?:/[a-zA-Z]{2,3}_[a-zA-Z]{2,3})?|-plasma-ias-(?:phone|tablet)-[a-z]{2}_[A-Z]{2}\.vflset)/base\.js$',
|
||||
r'\b(?P<id>vfl[a-zA-Z0-9_-]+)\b.*?\.js$',
|
||||
)
|
||||
@ -1857,7 +1857,7 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
|
||||
def _extract_n_function_code_jsi(self, video_id, jsi, player_id=None):
|
||||
|
||||
var_ay = self._search_regex(
|
||||
r'(?:[;\s]|^)\s*(var\s*[\w$]+\s*=\s*"[^"]+"\s*\.\s*split\("\{"\))(?=\s*[,;])',
|
||||
r'(?:[;\s]|^)\s*(var\s*[\w$]+\s*=\s*"(?:\\"|[^"])+"\s*\.\s*split\("\W+"\))(?=\s*[,;])',
|
||||
jsi.code, 'useful values', default='')
|
||||
|
||||
func_name = self._extract_n_function_name(jsi.code)
|
||||
|
Loading…
x
Reference in New Issue
Block a user