1
0
Fork 0
mirror of https://gitlab.com/dstftw/youtube-dl.git synced 2020-11-16 09:42:26 +00:00

[qqmusic] Fix extraction for global list

This commit is contained in:
ping 2015-05-13 01:14:02 +08:00
parent b480e7874b
commit fd4eefed39

View file

@ -188,6 +188,13 @@ class QQMusicToplistIE(QQPlaylistBaseIE):
'title': 'QQ音乐巅峰榜·欧美', 'title': 'QQ音乐巅峰榜·欧美',
}, },
'playlist_count': 100, 'playlist_count': 100,
}, {
'url': 'http://y.qq.com/#type=toplist&p=global_5',
'info_dict': {
'id': 'global_5',
'title': '韩国mnet排行榜',
},
'playlist_count': 50,
}] }]
@staticmethod @staticmethod
@ -203,12 +210,16 @@ class QQMusicToplistIE(QQPlaylistBaseIE):
list_page = self._download_webpage( list_page = self._download_webpage(
"http://y.qq.com/y/static/toplist/index/%s.html" % list_id, "http://y.qq.com/y/static/toplist/index/%s.html" % list_id,
list_id, 'Download toplist page') list_id, 'Download toplist page')
entries = [] entries = []
jsonp_url = ""
if list_type == 'top': if list_type == 'top':
list = self._download_json( jsonp_url = "http://y.qq.com/y/static/toplist/json/top/%s/1.js" % num_id
"http://y.qq.com/y/static/toplist/json/top/%s/1.js" % num_id, elif list_type == 'global':
list_id, note='Retrieve toplist json', errnote='Unable to get toplist json', jsonp_url = "http://y.qq.com/y/static/toplist/json/global/%s/1_1.js" % num_id
transform_source=self.strip_qq_jsonp)
list = self._download_json(jsonp_url, list_id, note='Retrieve toplist json',
errnote='Unable to get toplist json', transform_source=self.strip_qq_jsonp)
for song in list['l']: for song in list['l']:
s = song['s'] s = song['s']
@ -217,9 +228,6 @@ class QQMusicToplistIE(QQPlaylistBaseIE):
'http://y.qq.com/#type=song&mid=' + song_mid, 'QQMusic', 'http://y.qq.com/#type=song&mid=' + song_mid, 'QQMusic',
song_mid)) song_mid))
elif list_type == 'global':
entries = self.get_entries_from_page(list_page)
list_name = self._html_search_regex( list_name = self._html_search_regex(
r'<h2 id="top_name">([^\']+)</h2>', list_page, 'top list name', r'<h2 id="top_name">([^\']+)</h2>', list_page, 'top list name',
default=None) default=None)