mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-18 14:19:18 +00:00
user playlist
This commit is contained in:
parent
6813763fc9
commit
fc2130f6bf
|
@ -418,19 +418,10 @@ def _real_extract(self, url):
|
||||||
class QQMusicPlaylistIE(QQPlaylistBaseIE):
|
class QQMusicPlaylistIE(QQPlaylistBaseIE):
|
||||||
IE_NAME = 'qqmusic:playlist'
|
IE_NAME = 'qqmusic:playlist'
|
||||||
IE_DESC = 'QQ音乐 - 歌单'
|
IE_DESC = 'QQ音乐 - 歌单'
|
||||||
_VALID_URL = r'https?://y\.qq\.com/n/yqq/playlist/(?P<id>[0-9]+)\.html'
|
_VALID_URL = r'https?://y\.qq\.com/n/ryqq/playlist/(?P<id>[0-9]+)'
|
||||||
|
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
'url': 'http://y.qq.com/n/yqq/playlist/3462654915.html',
|
'url': 'https://y.qq.com/n/ryqq/playlist/1374105607',
|
||||||
'info_dict': {
|
|
||||||
'id': '3462654915',
|
|
||||||
'title': '韩国5月新歌精选下旬',
|
|
||||||
'description': 'md5:d2c9d758a96b9888cf4fe82f603121d4',
|
|
||||||
},
|
|
||||||
'playlist_count': 40,
|
|
||||||
'skip': 'playlist gone',
|
|
||||||
}, {
|
|
||||||
'url': 'https://y.qq.com/n/yqq/playlist/1374105607.html',
|
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': '1374105607',
|
'id': '1374105607',
|
||||||
'title': '易入人心的华语民谣',
|
'title': '易入人心的华语民谣',
|
||||||
|
@ -446,22 +437,20 @@ def _real_extract(self, url):
|
||||||
'http://i.y.qq.com/qzone-music/fcg-bin/fcg_ucc_getcdinfo_byids_cp.fcg',
|
'http://i.y.qq.com/qzone-music/fcg-bin/fcg_ucc_getcdinfo_byids_cp.fcg',
|
||||||
list_id, 'Download list page',
|
list_id, 'Download list page',
|
||||||
query={'type': 1, 'json': 1, 'utf8': 1, 'onlysong': 0, 'disstid': list_id},
|
query={'type': 1, 'json': 1, 'utf8': 1, 'onlysong': 0, 'disstid': list_id},
|
||||||
transform_source=strip_jsonp)
|
transform_source=strip_jsonp, headers={'Referer': url})
|
||||||
if not len(list_json.get('cdlist', [])):
|
if not len(list_json.get('cdlist', [])):
|
||||||
if list_json.get('code'):
|
error_msg = ''
|
||||||
raise ExtractorError(
|
if list_json.get('code') or list_json.get('subcode'):
|
||||||
'QQ Music said: error %d in fetching playlist info' % list_json['code'],
|
error_msg = f': Error {list_json.get("code")}-{list_json["subcode"]}: {list_json.get("msg", "")}'
|
||||||
expected=True)
|
raise ExtractorError(f'Unable to get playlist info{error_msg}')
|
||||||
raise ExtractorError('Unable to get playlist info')
|
|
||||||
|
|
||||||
cdlist = list_json['cdlist'][0]
|
entries = traverse_obj(list_json, ('cdlist', 0, 'songlist', ..., {lambda song: self.url_result(
|
||||||
entries = [self.url_result(
|
f'https://y.qq.com/n/ryqq/songDetail/{song["songmid"]}', QQMusicIE, song['songmid'], song['songname'])}))
|
||||||
'https://y.qq.com/n/yqq/song/' + song['songmid'] + '.html', 'QQMusic', song['songmid'])
|
|
||||||
for song in cdlist['songlist']]
|
|
||||||
|
|
||||||
list_name = cdlist.get('dissname')
|
return self.playlist_result(entries, list_id, **traverse_obj(list_json, ('cdlist', 0, {
|
||||||
list_description = clean_html(unescapeHTML(cdlist.get('desc')))
|
'title': ('dissname', {str}),
|
||||||
return self.playlist_result(entries, list_id, list_name, list_description)
|
'description': ('desc', {lambda x: clean_html(unescapeHTML(x))}),
|
||||||
|
})))
|
||||||
|
|
||||||
|
|
||||||
class QQMusicVideoIE(InfoExtractor):
|
class QQMusicVideoIE(InfoExtractor):
|
||||||
|
|
Loading…
Reference in a new issue