mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2025-10-13 05:48:30 +00:00
[ie/musescore] Fix extractor (#14598)
Closes #14485 Authored by: seproDev
This commit is contained in:
parent
ccc25d6710
commit
87be1bb96a
@ -1,3 +1,5 @@
|
||||
import hashlib
|
||||
|
||||
from .common import InfoExtractor
|
||||
|
||||
|
||||
@ -9,10 +11,10 @@ class MuseScoreIE(InfoExtractor):
|
||||
'id': '142975',
|
||||
'ext': 'mp3',
|
||||
'title': 'WA Mozart Marche Turque (Turkish March fingered)',
|
||||
'description': 'md5:7ede08230e4eaabd67a4a98bb54d07be',
|
||||
'thumbnail': r're:https?://(?:www\.)?musescore\.com/.*\.png[^$]+',
|
||||
'description': 'md5:0ca4cf6b79d7f5868a1fee74097394ab',
|
||||
'thumbnail': r're:https?://cdn\.ustatik\.com/musescore/.*\.jpg',
|
||||
'uploader': 'PapyPiano',
|
||||
'creator': 'Wolfgang Amadeus Mozart',
|
||||
'creators': ['Wolfgang Amadeus Mozart'],
|
||||
},
|
||||
}, {
|
||||
'url': 'https://musescore.com/user/36164500/scores/6837638',
|
||||
@ -20,10 +22,10 @@ class MuseScoreIE(InfoExtractor):
|
||||
'id': '6837638',
|
||||
'ext': 'mp3',
|
||||
'title': 'Sweet Child O\' Mine – Guns N\' Roses sweet child',
|
||||
'description': 'md5:4dca71191c14abc312a0a4192492eace',
|
||||
'thumbnail': r're:https?://(?:www\.)?musescore\.com/.*\.png[^$]+',
|
||||
'description': 'md5:2cd49bd6b4e48a75a3c469d4775d5079',
|
||||
'thumbnail': r're:https?://cdn\.ustatik\.com/musescore/.*\.png',
|
||||
'uploader': 'roxbelviolin',
|
||||
'creator': 'Guns N´Roses Arr. Roxbel Violin',
|
||||
'creators': ['Guns N´Roses Arr. Roxbel Violin'],
|
||||
},
|
||||
}, {
|
||||
'url': 'https://musescore.com/classicman/fur-elise',
|
||||
@ -31,22 +33,28 @@ class MuseScoreIE(InfoExtractor):
|
||||
'id': '33816',
|
||||
'ext': 'mp3',
|
||||
'title': 'Für Elise – Beethoven',
|
||||
'description': 'md5:49515a3556d5ecaf9fa4b2514064ac34',
|
||||
'thumbnail': r're:https?://(?:www\.)?musescore\.com/.*\.png[^$]+',
|
||||
'description': 'md5:e37b241c0280b33e9ac25651b815d06e',
|
||||
'thumbnail': r're:https?://cdn\.ustatik\.com/musescore/.*\.jpg',
|
||||
'uploader': 'ClassicMan',
|
||||
'creator': 'Ludwig van Beethoven (1770–1827)',
|
||||
'creators': ['Ludwig van Beethoven (1770–1827)'],
|
||||
},
|
||||
}, {
|
||||
'url': 'https://musescore.com/minh_cuteee/scores/6555384',
|
||||
'only_matching': True,
|
||||
}]
|
||||
|
||||
@staticmethod
|
||||
def _generate_auth_token(video_id):
|
||||
return hashlib.md5((video_id + 'mp30gs').encode()).hexdigest()[:4]
|
||||
|
||||
def _real_extract(self, url):
|
||||
webpage = self._download_webpage(url, None)
|
||||
url = self._og_search_url(webpage) or url
|
||||
video_id = self._match_id(url)
|
||||
mp3_url = self._download_json(f'https://musescore.com/api/jmuse?id={video_id}&index=0&type=mp3&v2=1', video_id,
|
||||
headers={'authorization': '63794e5461e4cfa046edfbdddfccc1ac16daffd2'})['info']['url']
|
||||
mp3_url = self._download_json(
|
||||
'https://musescore.com/api/jmuse', video_id,
|
||||
headers={'authorization': self._generate_auth_token(video_id)},
|
||||
query={'id': video_id, 'index': '0', 'type': 'mp3'})['info']['url']
|
||||
formats = [{
|
||||
'url': mp3_url,
|
||||
'ext': 'mp3',
|
||||
@ -57,7 +65,7 @@ def _real_extract(self, url):
|
||||
'id': video_id,
|
||||
'formats': formats,
|
||||
'title': self._og_search_title(webpage),
|
||||
'description': self._og_search_description(webpage),
|
||||
'description': self._html_search_meta('description', webpage, 'description'),
|
||||
'thumbnail': self._og_search_thumbnail(webpage),
|
||||
'uploader': self._html_search_meta('musescore:author', webpage, 'uploader'),
|
||||
'creator': self._html_search_meta('musescore:composer', webpage, 'composer'),
|
||||
|
Loading…
Reference in New Issue
Block a user