2015-06-18 02:15:54 -04:00
|
|
|
import re
|
2024-06-11 19:09:58 -04:00
|
|
|
import urllib.parse
|
2015-06-18 02:15:54 -04:00
|
|
|
|
|
|
|
from .common import InfoExtractor
|
|
|
|
from ..utils import (
|
|
|
|
ExtractorError,
|
2016-03-20 08:17:56 -04:00
|
|
|
InAdvancePagedList,
|
2024-05-26 15:27:21 -04:00
|
|
|
clean_html,
|
|
|
|
get_element_by_id,
|
2015-07-10 11:23:07 -04:00
|
|
|
remove_start,
|
2015-06-18 02:15:54 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
|
2015-07-10 11:46:44 -04:00
|
|
|
class KuwoBaseIE(InfoExtractor):
|
2015-06-18 02:15:54 -04:00
|
|
|
_FORMATS = [
|
|
|
|
{'format': 'ape', 'ext': 'ape', 'preference': 100},
|
|
|
|
{'format': 'mp3-320', 'ext': 'mp3', 'br': '320kmp3', 'abr': 320, 'preference': 80},
|
|
|
|
{'format': 'mp3-192', 'ext': 'mp3', 'br': '192kmp3', 'abr': 192, 'preference': 70},
|
|
|
|
{'format': 'mp3-128', 'ext': 'mp3', 'br': '128kmp3', 'abr': 128, 'preference': 60},
|
|
|
|
{'format': 'wma', 'ext': 'wma', 'preference': 20},
|
2024-06-11 19:09:58 -04:00
|
|
|
{'format': 'aac', 'ext': 'aac', 'abr': 48, 'preference': 10},
|
2015-06-18 02:15:54 -04:00
|
|
|
]
|
|
|
|
|
2016-03-14 14:20:37 -04:00
|
|
|
def _get_formats(self, song_id, tolerate_ip_deny=False):
|
2015-06-18 02:15:54 -04:00
|
|
|
formats = []
|
|
|
|
for file_format in self._FORMATS:
|
2016-03-30 14:27:52 -04:00
|
|
|
query = {
|
|
|
|
'format': file_format['ext'],
|
|
|
|
'br': file_format.get('br', ''),
|
2024-06-11 19:09:58 -04:00
|
|
|
'rid': f'MUSIC_{song_id}',
|
2016-03-30 14:27:52 -04:00
|
|
|
'type': 'convert_url',
|
2024-06-11 19:09:58 -04:00
|
|
|
'response': 'url',
|
2016-03-30 14:27:52 -04:00
|
|
|
}
|
|
|
|
|
2015-06-18 02:15:54 -04:00
|
|
|
song_url = self._download_webpage(
|
2016-03-30 14:27:52 -04:00
|
|
|
'http://antiserver.kuwo.cn/anti.s',
|
2024-06-11 19:09:58 -04:00
|
|
|
song_id, note='Download {} url info'.format(file_format['format']),
|
2016-07-03 11:23:48 -04:00
|
|
|
query=query, headers=self.geo_verification_headers(),
|
2015-06-18 02:15:54 -04:00
|
|
|
)
|
2016-02-03 12:26:25 -05:00
|
|
|
|
2016-03-14 14:20:37 -04:00
|
|
|
if song_url == 'IPDeny' and not tolerate_ip_deny:
|
2016-02-03 12:26:25 -05:00
|
|
|
raise ExtractorError('This song is blocked in this region', expected=True)
|
|
|
|
|
2024-06-11 19:09:58 -04:00
|
|
|
if song_url.startswith(('http://', 'https://')):
|
2015-06-18 02:15:54 -04:00
|
|
|
formats.append({
|
|
|
|
'url': song_url,
|
|
|
|
'format_id': file_format['format'],
|
|
|
|
'format': file_format['format'],
|
2021-02-18 17:03:16 -05:00
|
|
|
'quality': file_format['preference'],
|
2015-06-18 02:15:54 -04:00
|
|
|
'abr': file_format.get('abr'),
|
|
|
|
})
|
2016-03-14 14:20:37 -04:00
|
|
|
|
2015-06-18 02:15:54 -04:00
|
|
|
return formats
|
|
|
|
|
2015-07-10 11:46:44 -04:00
|
|
|
|
|
|
|
class KuwoIE(KuwoBaseIE):
|
2024-03-08 19:02:45 -05:00
|
|
|
_WORKING = False
|
2015-07-10 11:46:44 -04:00
|
|
|
IE_NAME = 'kuwo:song'
|
2015-07-10 12:51:14 -04:00
|
|
|
IE_DESC = '酷我音乐'
|
2016-09-08 07:29:05 -04:00
|
|
|
_VALID_URL = r'https?://(?:www\.)?kuwo\.cn/yinyue/(?P<id>\d+)'
|
2015-07-10 11:46:44 -04:00
|
|
|
_TESTS = [{
|
|
|
|
'url': 'http://www.kuwo.cn/yinyue/635632/',
|
|
|
|
'info_dict': {
|
|
|
|
'id': '635632',
|
|
|
|
'ext': 'ape',
|
|
|
|
'title': '爱我别走',
|
|
|
|
'creator': '张震岳',
|
|
|
|
'upload_date': '20080122',
|
2024-06-11 19:09:58 -04:00
|
|
|
'description': 'md5:ed13f58e3c3bf3f7fd9fbc4e5a7aa75c',
|
2015-07-10 11:46:44 -04:00
|
|
|
},
|
2015-09-25 06:28:26 -04:00
|
|
|
'skip': 'this song has been offline because of copyright issues',
|
2015-07-10 11:46:44 -04:00
|
|
|
}, {
|
|
|
|
'url': 'http://www.kuwo.cn/yinyue/6446136/',
|
|
|
|
'info_dict': {
|
|
|
|
'id': '6446136',
|
|
|
|
'ext': 'mp3',
|
|
|
|
'title': '心',
|
2016-04-24 10:19:26 -04:00
|
|
|
'description': 'md5:5d0e947b242c35dc0eb1d2fce9fbf02c',
|
2015-07-10 11:46:44 -04:00
|
|
|
'creator': 'IU',
|
|
|
|
'upload_date': '20150518',
|
|
|
|
},
|
|
|
|
'params': {
|
2016-09-14 12:53:04 -04:00
|
|
|
'format': 'mp3-320',
|
2015-07-10 11:46:44 -04:00
|
|
|
},
|
2016-03-20 08:17:56 -04:00
|
|
|
}, {
|
|
|
|
'url': 'http://www.kuwo.cn/yinyue/3197154?catalog=yueku2016',
|
|
|
|
'only_matching': True,
|
2015-07-10 11:46:44 -04:00
|
|
|
}]
|
|
|
|
|
2015-06-18 02:15:54 -04:00
|
|
|
def _real_extract(self, url):
|
|
|
|
song_id = self._match_id(url)
|
2016-09-14 12:56:15 -04:00
|
|
|
webpage, urlh = self._download_webpage_handle(
|
2015-06-18 02:15:54 -04:00
|
|
|
url, song_id, note='Download song detail info',
|
|
|
|
errnote='Unable to get song detail info')
|
2023-07-09 03:53:02 -04:00
|
|
|
if song_id not in urlh.url or '对不起,该歌曲由于版权问题已被下线,将返回网站首页' in webpage:
|
2015-09-26 06:44:35 -04:00
|
|
|
raise ExtractorError('this song has been offline because of copyright issues', expected=True)
|
2015-06-18 02:15:54 -04:00
|
|
|
|
|
|
|
song_name = self._html_search_regex(
|
2016-04-24 10:19:26 -04:00
|
|
|
r'<p[^>]+id="lrcName">([^<]+)</p>', webpage, 'song name')
|
|
|
|
singer_name = remove_start(self._html_search_regex(
|
|
|
|
r'<a[^>]+href="http://www\.kuwo\.cn/artist/content\?name=([^"]+)">',
|
|
|
|
webpage, 'singer name', fatal=False), '歌手')
|
2015-07-10 11:48:48 -04:00
|
|
|
lrc_content = clean_html(get_element_by_id('lrcContent', webpage))
|
2015-06-18 02:15:54 -04:00
|
|
|
if lrc_content == '暂无': # indicates no lyrics
|
|
|
|
lrc_content = None
|
|
|
|
|
|
|
|
formats = self._get_formats(song_id)
|
|
|
|
|
|
|
|
album_id = self._html_search_regex(
|
2016-04-24 10:19:26 -04:00
|
|
|
r'<a[^>]+href="http://www\.kuwo\.cn/album/(\d+)/"',
|
2015-07-10 12:03:49 -04:00
|
|
|
webpage, 'album id', fatal=False)
|
2015-06-18 02:15:54 -04:00
|
|
|
|
|
|
|
publish_time = None
|
|
|
|
if album_id is not None:
|
|
|
|
album_info_page = self._download_webpage(
|
2024-06-11 19:09:58 -04:00
|
|
|
f'http://www.kuwo.cn/album/{album_id}/', song_id,
|
2015-06-18 02:15:54 -04:00
|
|
|
note='Download album detail info',
|
|
|
|
errnote='Unable to get album detail info')
|
|
|
|
|
|
|
|
publish_time = self._html_search_regex(
|
|
|
|
r'发行时间:(\d{4}-\d{2}-\d{2})', album_info_page,
|
2015-07-10 12:03:49 -04:00
|
|
|
'publish time', fatal=False)
|
2015-06-18 02:15:54 -04:00
|
|
|
if publish_time:
|
|
|
|
publish_time = publish_time.replace('-', '')
|
|
|
|
|
|
|
|
return {
|
|
|
|
'id': song_id,
|
|
|
|
'title': song_name,
|
|
|
|
'creator': singer_name,
|
|
|
|
'upload_date': publish_time,
|
|
|
|
'description': lrc_content,
|
|
|
|
'formats': formats,
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
class KuwoAlbumIE(InfoExtractor):
|
2024-03-08 19:02:45 -05:00
|
|
|
_WORKING = False
|
2015-06-18 02:15:54 -04:00
|
|
|
IE_NAME = 'kuwo:album'
|
2015-07-10 13:21:04 -04:00
|
|
|
IE_DESC = '酷我音乐 - 专辑'
|
2016-09-08 07:29:05 -04:00
|
|
|
_VALID_URL = r'https?://(?:www\.)?kuwo\.cn/album/(?P<id>\d+?)/'
|
2015-06-18 02:15:54 -04:00
|
|
|
_TEST = {
|
|
|
|
'url': 'http://www.kuwo.cn/album/502294/',
|
|
|
|
'info_dict': {
|
|
|
|
'id': '502294',
|
2016-06-11 03:37:04 -04:00
|
|
|
'title': 'Made\xa0Series\xa0《M》',
|
|
|
|
'description': 'md5:d463f0d8a0ff3c3ea3d6ed7452a9483f',
|
2015-06-18 02:15:54 -04:00
|
|
|
},
|
|
|
|
'playlist_count': 2,
|
|
|
|
}
|
|
|
|
|
|
|
|
def _real_extract(self, url):
|
|
|
|
album_id = self._match_id(url)
|
|
|
|
|
|
|
|
webpage = self._download_webpage(
|
|
|
|
url, album_id, note='Download album info',
|
|
|
|
errnote='Unable to get album info')
|
|
|
|
|
|
|
|
album_name = self._html_search_regex(
|
2015-07-10 11:23:07 -04:00
|
|
|
r'<div[^>]+class="comm"[^<]+<h1[^>]+title="([^"]+)"', webpage,
|
|
|
|
'album name')
|
|
|
|
album_intro = remove_start(
|
2015-07-10 11:48:48 -04:00
|
|
|
clean_html(get_element_by_id('intro', webpage)),
|
2024-06-11 19:09:58 -04:00
|
|
|
f'{album_name}简介:')
|
2015-06-18 02:15:54 -04:00
|
|
|
|
|
|
|
entries = [
|
2015-07-10 11:53:48 -04:00
|
|
|
self.url_result(song_url, 'Kuwo') for song_url in re.findall(
|
|
|
|
r'<p[^>]+class="listen"><a[^>]+href="(http://www\.kuwo\.cn/yinyue/\d+/)"',
|
2015-06-18 02:15:54 -04:00
|
|
|
webpage)
|
|
|
|
]
|
|
|
|
return self.playlist_result(entries, album_id, album_name, album_intro)
|
|
|
|
|
|
|
|
|
|
|
|
class KuwoChartIE(InfoExtractor):
|
2024-03-08 19:02:45 -05:00
|
|
|
_WORKING = False
|
2015-06-18 02:15:54 -04:00
|
|
|
IE_NAME = 'kuwo:chart'
|
2015-07-10 13:21:04 -04:00
|
|
|
IE_DESC = '酷我音乐 - 排行榜'
|
2016-03-21 11:36:32 -04:00
|
|
|
_VALID_URL = r'https?://yinyue\.kuwo\.cn/billboard_(?P<id>[^.]+).htm'
|
2015-06-18 02:15:54 -04:00
|
|
|
_TEST = {
|
|
|
|
'url': 'http://yinyue.kuwo.cn/billboard_香港中文龙虎榜.htm',
|
|
|
|
'info_dict': {
|
|
|
|
'id': '香港中文龙虎榜',
|
|
|
|
},
|
2016-09-14 12:53:04 -04:00
|
|
|
'playlist_mincount': 7,
|
2015-06-18 02:15:54 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
def _real_extract(self, url):
|
|
|
|
chart_id = self._match_id(url)
|
|
|
|
webpage = self._download_webpage(
|
|
|
|
url, chart_id, note='Download chart info',
|
|
|
|
errnote='Unable to get chart info')
|
|
|
|
|
|
|
|
entries = [
|
2015-07-10 11:53:48 -04:00
|
|
|
self.url_result(song_url, 'Kuwo') for song_url in re.findall(
|
2016-03-20 08:17:56 -04:00
|
|
|
r'<a[^>]+href="(http://www\.kuwo\.cn/yinyue/\d+)', webpage)
|
2015-06-18 02:15:54 -04:00
|
|
|
]
|
2016-03-20 08:17:56 -04:00
|
|
|
return self.playlist_result(entries, chart_id)
|
2015-06-18 02:15:54 -04:00
|
|
|
|
|
|
|
|
|
|
|
class KuwoSingerIE(InfoExtractor):
|
2024-03-08 19:02:45 -05:00
|
|
|
_WORKING = False
|
2015-06-18 02:15:54 -04:00
|
|
|
IE_NAME = 'kuwo:singer'
|
2015-07-10 13:21:04 -04:00
|
|
|
IE_DESC = '酷我音乐 - 歌手'
|
2016-09-08 07:29:05 -04:00
|
|
|
_VALID_URL = r'https?://(?:www\.)?kuwo\.cn/mingxing/(?P<id>[^/]+)'
|
2015-07-10 03:19:07 -04:00
|
|
|
_TESTS = [{
|
2015-06-18 02:15:54 -04:00
|
|
|
'url': 'http://www.kuwo.cn/mingxing/bruno+mars/',
|
|
|
|
'info_dict': {
|
|
|
|
'id': 'bruno+mars',
|
2016-06-11 03:37:04 -04:00
|
|
|
'title': 'Bruno\xa0Mars',
|
2015-06-18 02:15:54 -04:00
|
|
|
},
|
2016-03-20 08:17:56 -04:00
|
|
|
'playlist_mincount': 329,
|
2015-07-10 03:19:07 -04:00
|
|
|
}, {
|
2015-06-18 02:15:54 -04:00
|
|
|
'url': 'http://www.kuwo.cn/mingxing/Ali/music.htm',
|
|
|
|
'info_dict': {
|
|
|
|
'id': 'Ali',
|
2015-07-10 03:19:07 -04:00
|
|
|
'title': 'Ali',
|
2015-06-18 02:15:54 -04:00
|
|
|
},
|
|
|
|
'playlist_mincount': 95,
|
2019-03-09 07:14:41 -05:00
|
|
|
'skip': 'Regularly stalls travis build', # See https://travis-ci.org/ytdl-org/youtube-dl/jobs/78878540
|
2015-07-10 03:19:07 -04:00
|
|
|
}]
|
2015-06-18 02:15:54 -04:00
|
|
|
|
2016-03-20 08:17:56 -04:00
|
|
|
PAGE_SIZE = 15
|
|
|
|
|
2015-06-18 02:15:54 -04:00
|
|
|
def _real_extract(self, url):
|
|
|
|
singer_id = self._match_id(url)
|
2015-07-10 03:19:07 -04:00
|
|
|
webpage = self._download_webpage(
|
|
|
|
url, singer_id, note='Download singer info',
|
|
|
|
errnote='Unable to get singer info')
|
|
|
|
|
|
|
|
singer_name = self._html_search_regex(
|
2016-03-20 08:17:56 -04:00
|
|
|
r'<h1>([^<]+)</h1>', webpage, 'singer name')
|
|
|
|
|
|
|
|
artist_id = self._html_search_regex(
|
|
|
|
r'data-artistid="(\d+)"', webpage, 'artist id')
|
|
|
|
|
|
|
|
page_count = int(self._html_search_regex(
|
|
|
|
r'data-page="(\d+)"', webpage, 'page count'))
|
2015-06-18 02:15:54 -04:00
|
|
|
|
2016-03-20 08:17:56 -04:00
|
|
|
def page_func(page_num):
|
2015-06-18 02:15:54 -04:00
|
|
|
webpage = self._download_webpage(
|
2016-03-20 08:17:56 -04:00
|
|
|
'http://www.kuwo.cn/artist/contentMusicsAjax',
|
2024-06-11 19:09:58 -04:00
|
|
|
singer_id, note=f'Download song list page #{page_num + 1}',
|
|
|
|
errnote=f'Unable to get song list page #{page_num + 1}',
|
2016-03-20 08:17:56 -04:00
|
|
|
query={'artistId': artist_id, 'pn': page_num, 'rn': self.PAGE_SIZE})
|
2015-06-18 02:15:54 -04:00
|
|
|
|
2016-03-20 08:17:56 -04:00
|
|
|
return [
|
2024-06-11 19:09:58 -04:00
|
|
|
self.url_result(urllib.parse.urljoin(url, song_url), 'Kuwo')
|
2016-08-07 10:59:34 -04:00
|
|
|
for song_url in re.findall(
|
|
|
|
r'<div[^>]+class="name"><a[^>]+href="(/yinyue/\d+)',
|
2015-06-18 02:15:54 -04:00
|
|
|
webpage)
|
2016-03-20 08:17:56 -04:00
|
|
|
]
|
2015-07-10 03:19:07 -04:00
|
|
|
|
2016-03-20 08:17:56 -04:00
|
|
|
entries = InAdvancePagedList(page_func, page_count, self.PAGE_SIZE)
|
2015-06-18 02:15:54 -04:00
|
|
|
|
2015-07-10 03:19:07 -04:00
|
|
|
return self.playlist_result(entries, singer_id, singer_name)
|
2015-06-18 02:15:54 -04:00
|
|
|
|
|
|
|
|
|
|
|
class KuwoCategoryIE(InfoExtractor):
|
2024-03-08 19:02:45 -05:00
|
|
|
_WORKING = False
|
2015-06-18 02:15:54 -04:00
|
|
|
IE_NAME = 'kuwo:category'
|
2015-07-10 13:21:04 -04:00
|
|
|
IE_DESC = '酷我音乐 - 分类'
|
2016-03-21 11:36:32 -04:00
|
|
|
_VALID_URL = r'https?://yinyue\.kuwo\.cn/yy/cinfo_(?P<id>\d+?).htm'
|
2015-06-18 02:15:54 -04:00
|
|
|
_TEST = {
|
|
|
|
'url': 'http://yinyue.kuwo.cn/yy/cinfo_86375.htm',
|
|
|
|
'info_dict': {
|
|
|
|
'id': '86375',
|
|
|
|
'title': '八十年代精选',
|
2016-05-05 08:06:59 -04:00
|
|
|
'description': '这些都是属于八十年代的回忆!',
|
2015-06-18 02:15:54 -04:00
|
|
|
},
|
2016-04-24 09:16:06 -04:00
|
|
|
'playlist_mincount': 24,
|
2015-06-18 02:15:54 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
def _real_extract(self, url):
|
|
|
|
category_id = self._match_id(url)
|
|
|
|
webpage = self._download_webpage(
|
|
|
|
url, category_id, note='Download category info',
|
|
|
|
errnote='Unable to get category info')
|
|
|
|
|
|
|
|
category_name = self._html_search_regex(
|
2015-07-10 11:23:07 -04:00
|
|
|
r'<h1[^>]+title="([^<>]+?)">[^<>]+?</h1>', webpage, 'category name')
|
2015-07-10 07:13:52 -04:00
|
|
|
|
2015-07-10 11:23:07 -04:00
|
|
|
category_desc = remove_start(
|
2015-07-10 11:48:48 -04:00
|
|
|
get_element_by_id('intro', webpage).strip(),
|
2024-06-11 19:09:58 -04:00
|
|
|
f'{category_name}简介:')
|
2016-05-03 04:06:28 -04:00
|
|
|
if category_desc == '暂无':
|
|
|
|
category_desc = None
|
2015-07-10 07:13:52 -04:00
|
|
|
|
2015-06-18 02:15:54 -04:00
|
|
|
jsonm = self._parse_json(self._html_search_regex(
|
2015-07-10 11:23:07 -04:00
|
|
|
r'var\s+jsonm\s*=\s*([^;]+);', webpage, 'category songs'), category_id)
|
2015-06-18 02:15:54 -04:00
|
|
|
|
|
|
|
entries = [
|
2024-06-11 19:09:58 -04:00
|
|
|
self.url_result('http://www.kuwo.cn/yinyue/{}/'.format(song['musicrid']), 'Kuwo')
|
2015-06-18 02:15:54 -04:00
|
|
|
for song in jsonm['musiclist']
|
|
|
|
]
|
|
|
|
return self.playlist_result(entries, category_id, category_name, category_desc)
|
|
|
|
|
|
|
|
|
2015-07-10 11:46:44 -04:00
|
|
|
class KuwoMvIE(KuwoBaseIE):
|
2024-03-08 19:02:45 -05:00
|
|
|
_WORKING = False
|
2015-06-18 02:15:54 -04:00
|
|
|
IE_NAME = 'kuwo:mv'
|
2015-07-10 13:21:04 -04:00
|
|
|
IE_DESC = '酷我音乐 - MV'
|
2016-09-08 07:29:05 -04:00
|
|
|
_VALID_URL = r'https?://(?:www\.)?kuwo\.cn/mv/(?P<id>\d+?)/'
|
2015-07-10 11:46:44 -04:00
|
|
|
_TEST = {
|
2015-06-18 02:15:54 -04:00
|
|
|
'url': 'http://www.kuwo.cn/mv/6480076/',
|
|
|
|
'info_dict': {
|
|
|
|
'id': '6480076',
|
2016-03-14 14:20:37 -04:00
|
|
|
'ext': 'mp4',
|
|
|
|
'title': 'My HouseMV',
|
2016-09-14 12:53:04 -04:00
|
|
|
'creator': '2PM',
|
2015-06-18 02:15:54 -04:00
|
|
|
},
|
2016-03-14 14:20:37 -04:00
|
|
|
# In this video, music URLs (anti.s) are blocked outside China and
|
|
|
|
# USA, while the MV URL (mvurl) is available globally, so force the MV
|
|
|
|
# URL for consistent results in different countries
|
|
|
|
'params': {
|
|
|
|
'format': 'mv',
|
|
|
|
},
|
2015-07-10 11:46:44 -04:00
|
|
|
}
|
2024-06-11 19:09:58 -04:00
|
|
|
_FORMATS = [
|
|
|
|
*KuwoBaseIE._FORMATS,
|
2015-06-18 02:15:54 -04:00
|
|
|
{'format': 'mkv', 'ext': 'mkv', 'preference': 250},
|
2024-06-11 19:09:58 -04:00
|
|
|
{'format': 'mp4', 'ext': 'mp4', 'preference': 200}]
|
2015-06-18 02:15:54 -04:00
|
|
|
|
|
|
|
def _real_extract(self, url):
|
|
|
|
song_id = self._match_id(url)
|
|
|
|
webpage = self._download_webpage(
|
2024-06-11 19:09:58 -04:00
|
|
|
url, song_id, note=f'Download mv detail info: {song_id}',
|
|
|
|
errnote=f'Unable to get mv detail info: {song_id}')
|
2015-06-18 02:15:54 -04:00
|
|
|
|
|
|
|
mobj = re.search(
|
2015-07-10 11:23:07 -04:00
|
|
|
r'<h1[^>]+title="(?P<song>[^"]+)">[^<]+<span[^>]+title="(?P<singer>[^"]+)"',
|
2015-06-18 02:15:54 -04:00
|
|
|
webpage)
|
|
|
|
if mobj:
|
|
|
|
song_name = mobj.group('song')
|
|
|
|
singer_name = mobj.group('singer')
|
|
|
|
else:
|
2015-07-10 11:48:48 -04:00
|
|
|
raise ExtractorError('Unable to find song or singer names')
|
2015-06-18 02:15:54 -04:00
|
|
|
|
2016-03-14 14:20:37 -04:00
|
|
|
formats = self._get_formats(song_id, tolerate_ip_deny=True)
|
|
|
|
|
|
|
|
mv_url = self._download_webpage(
|
2024-06-11 19:09:58 -04:00
|
|
|
f'http://www.kuwo.cn/yy/st/mvurl?rid=MUSIC_{song_id}',
|
|
|
|
song_id, note=f'Download {song_id} MV URL')
|
2016-03-14 14:20:37 -04:00
|
|
|
formats.append({
|
|
|
|
'url': mv_url,
|
|
|
|
'format_id': 'mv',
|
|
|
|
})
|
|
|
|
|
2015-06-18 02:15:54 -04:00
|
|
|
return {
|
|
|
|
'id': song_id,
|
|
|
|
'title': song_name,
|
|
|
|
'creator': singer_name,
|
|
|
|
'formats': formats,
|
|
|
|
}
|