2023-02-17 05:03:04 +01:00
|
|
|
from .common import InfoExtractor
|
|
|
|
from ..utils import js_to_json, traverse_obj
|
|
|
|
|
|
|
|
|
|
|
|
class MonsterSirenHypergryphMusicIE(InfoExtractor):
|
|
|
|
_VALID_URL = r'https?://monster-siren\.hypergryph\.com/music/(?P<id>\d+)'
|
|
|
|
_TESTS = [{
|
|
|
|
'url': 'https://monster-siren.hypergryph.com/music/514562',
|
|
|
|
'info_dict': {
|
|
|
|
'id': '514562',
|
|
|
|
'ext': 'wav',
|
2024-03-08 23:36:41 +01:00
|
|
|
'artists': ['塞壬唱片-MSR'],
|
2023-02-17 05:03:04 +01:00
|
|
|
'album': 'Flame Shadow',
|
|
|
|
'title': 'Flame Shadow',
|
2024-06-12 01:09:58 +02:00
|
|
|
},
|
2023-02-17 05:03:04 +01:00
|
|
|
}]
|
|
|
|
|
|
|
|
def _real_extract(self, url):
|
|
|
|
audio_id = self._match_id(url)
|
|
|
|
webpage = self._download_webpage(url, audio_id)
|
|
|
|
json_data = self._search_json(
|
|
|
|
r'window\.g_initialProps\s*=', webpage, 'data', audio_id, transform_source=js_to_json)
|
|
|
|
|
|
|
|
return {
|
|
|
|
'id': audio_id,
|
|
|
|
'title': traverse_obj(json_data, ('player', 'songDetail', 'name')),
|
|
|
|
'url': traverse_obj(json_data, ('player', 'songDetail', 'sourceUrl')),
|
|
|
|
'ext': 'wav',
|
|
|
|
'vcodec': 'none',
|
2024-03-08 23:36:41 +01:00
|
|
|
'artists': traverse_obj(json_data, ('player', 'songDetail', 'artists', ...)),
|
2024-06-12 01:09:58 +02:00
|
|
|
'album': traverse_obj(json_data, ('musicPlay', 'albumDetail', 'name')),
|
2023-02-17 05:03:04 +01:00
|
|
|
}
|