1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2026-01-30 10:42:05 +00:00

[ie/whyp] Fix extractor (#15721)

Closes #15719
Authored by: bashonly
This commit is contained in:
bashonly
2026-01-28 18:28:55 -06:00
committed by GitHub
parent 5bf91072bc
commit f70ebf97ea

View File

@@ -1,6 +1,7 @@
from .common import InfoExtractor from .common import InfoExtractor
from ..utils import ( from ..utils import (
float_or_none, float_or_none,
int_or_none,
str_or_none, str_or_none,
traverse_obj, traverse_obj,
url_or_none, url_or_none,
@@ -11,17 +12,16 @@ class WhypIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?whyp\.it/tracks/(?P<id>\d+)' _VALID_URL = r'https?://(?:www\.)?whyp\.it/tracks/(?P<id>\d+)'
_TESTS = [{ _TESTS = [{
'url': 'https://www.whyp.it/tracks/18337/home-page-example-track-b4kq7', 'url': 'https://www.whyp.it/tracks/18337/home-page-example-track-b4kq7',
'md5': 'c1187b42ebf8605284e3dc92aeb33d16', 'md5': '02fd96427acd9547445979bf0496b013',
'info_dict': { 'info_dict': {
'url': 'https://cdn.whyp.it/50eb17cc-e9ff-4e18-b89b-dc9206a95cb1.mp3',
'id': '18337', 'id': '18337',
'title': 'Home Page Example Track', 'title': 'Example Track',
'description': 'md5:bd758000fb93f3159339c852b5b9133c', 'description': 'md5:e0b1bcf1d267dc1a0f15efff09c8f297',
'ext': 'mp3', 'ext': 'flac',
'duration': 52.82, 'duration': 135.63,
'uploader': 'Brad', 'uploader': 'Brad',
'uploader_id': '1', 'uploader_id': '1',
'thumbnail': 'https://cdn.whyp.it/a537bb36-3373-4c61-96c8-27fc1b2f427a.jpg', 'thumbnail': 'https://cdn.whyp.it/6ad0bbd9-577d-42bb-9b61-2a4f57f647eb.jpg',
}, },
}, { }, {
'url': 'https://www.whyp.it/tracks/18337', 'url': 'https://www.whyp.it/tracks/18337',
@@ -34,8 +34,15 @@ class WhypIE(InfoExtractor):
data = self._search_nuxt_data(webpage, unique_id)['rawTrack'] data = self._search_nuxt_data(webpage, unique_id)['rawTrack']
return { return {
'url': data['audio_url'],
'id': unique_id, 'id': unique_id,
'formats': [{
'url': data[f'{prefix}_url'],
'format_id': prefix,
'filesize': int_or_none(data.get(f'{prefix}_size')),
'vcodec': 'none',
'quality': 10 if prefix == 'lossless' else -1,
'http_headers': {'Referer': 'https://whyp.it/'},
} for prefix in ('audio', 'lossy', 'lossless') if url_or_none(data.get(f'{prefix}_url'))],
**traverse_obj(data, { **traverse_obj(data, {
'title': 'title', 'title': 'title',
'description': 'description', 'description': 'description',
@@ -44,7 +51,4 @@ class WhypIE(InfoExtractor):
'uploader_id': ('user', 'id', {str_or_none}), 'uploader_id': ('user', 'id', {str_or_none}),
'thumbnail': ('artwork_url', {url_or_none}), 'thumbnail': ('artwork_url', {url_or_none}),
}), }),
'ext': 'mp3',
'vcodec': 'none',
'http_headers': {'Referer': 'https://whyp.it/'},
} }