2021-09-11 15:21:11 +02:00
|
|
|
|
from .common import InfoExtractor
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class MuseScoreIE(InfoExtractor):
|
2021-11-30 17:14:47 +01:00
|
|
|
|
_VALID_URL = r'https?://(?:www\.)?musescore\.com/(?:user/\d+|[^/]+)(?:/scores)?/(?P<id>[^#&?]+)'
|
2021-09-11 15:21:11 +02:00
|
|
|
|
_TESTS = [{
|
|
|
|
|
'url': 'https://musescore.com/user/73797/scores/142975',
|
|
|
|
|
'info_dict': {
|
|
|
|
|
'id': '142975',
|
|
|
|
|
'ext': 'mp3',
|
|
|
|
|
'title': 'WA Mozart Marche Turque (Turkish March fingered)',
|
|
|
|
|
'description': 'md5:7ede08230e4eaabd67a4a98bb54d07be',
|
2021-11-30 17:14:47 +01:00
|
|
|
|
'thumbnail': r're:https?://(?:www\.)?musescore\.com/.*\.png[^$]+',
|
2021-09-11 15:21:11 +02:00
|
|
|
|
'uploader': 'PapyPiano',
|
|
|
|
|
'creator': 'Wolfgang Amadeus Mozart',
|
2024-06-12 01:09:58 +02:00
|
|
|
|
},
|
2021-09-11 15:21:11 +02:00
|
|
|
|
}, {
|
|
|
|
|
'url': 'https://musescore.com/user/36164500/scores/6837638',
|
|
|
|
|
'info_dict': {
|
|
|
|
|
'id': '6837638',
|
|
|
|
|
'ext': 'mp3',
|
|
|
|
|
'title': 'Sweet Child O\' Mine – Guns N\' Roses sweet child',
|
|
|
|
|
'description': 'md5:4dca71191c14abc312a0a4192492eace',
|
2021-11-30 17:14:47 +01:00
|
|
|
|
'thumbnail': r're:https?://(?:www\.)?musescore\.com/.*\.png[^$]+',
|
2021-09-11 15:21:11 +02:00
|
|
|
|
'uploader': 'roxbelviolin',
|
|
|
|
|
'creator': 'Guns N´Roses Arr. Roxbel Violin',
|
2024-06-12 01:09:58 +02:00
|
|
|
|
},
|
2021-09-11 15:21:11 +02:00
|
|
|
|
}, {
|
|
|
|
|
'url': 'https://musescore.com/classicman/fur-elise',
|
|
|
|
|
'info_dict': {
|
|
|
|
|
'id': '33816',
|
|
|
|
|
'ext': 'mp3',
|
|
|
|
|
'title': 'Für Elise – Beethoven',
|
|
|
|
|
'description': 'md5:49515a3556d5ecaf9fa4b2514064ac34',
|
2021-11-30 17:14:47 +01:00
|
|
|
|
'thumbnail': r're:https?://(?:www\.)?musescore\.com/.*\.png[^$]+',
|
2021-09-11 15:21:11 +02:00
|
|
|
|
'uploader': 'ClassicMan',
|
|
|
|
|
'creator': 'Ludwig van Beethoven (1770–1827)',
|
2024-06-12 01:09:58 +02:00
|
|
|
|
},
|
2021-09-11 15:21:11 +02:00
|
|
|
|
}, {
|
|
|
|
|
'url': 'https://musescore.com/minh_cuteee/scores/6555384',
|
|
|
|
|
'only_matching': True,
|
|
|
|
|
}]
|
|
|
|
|
|
|
|
|
|
def _real_extract(self, url):
|
|
|
|
|
webpage = self._download_webpage(url, None)
|
|
|
|
|
url = self._og_search_url(webpage) or url
|
2024-06-12 01:09:58 +02:00
|
|
|
|
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,
|
2021-09-11 15:21:11 +02:00
|
|
|
|
headers={'authorization': '63794e5461e4cfa046edfbdddfccc1ac16daffd2'})['info']['url']
|
|
|
|
|
formats = [{
|
|
|
|
|
'url': mp3_url,
|
|
|
|
|
'ext': 'mp3',
|
|
|
|
|
'vcodec': 'none',
|
|
|
|
|
}]
|
|
|
|
|
|
|
|
|
|
return {
|
2024-06-12 01:09:58 +02:00
|
|
|
|
'id': video_id,
|
2021-09-11 15:21:11 +02:00
|
|
|
|
'formats': formats,
|
|
|
|
|
'title': self._og_search_title(webpage),
|
|
|
|
|
'description': self._og_search_description(webpage),
|
|
|
|
|
'thumbnail': self._og_search_thumbnail(webpage),
|
|
|
|
|
'uploader': self._html_search_meta('musescore:author', webpage, 'uploader'),
|
|
|
|
|
'creator': self._html_search_meta('musescore:composer', webpage, 'composer'),
|
|
|
|
|
}
|