diff options
author | Yen Chi Hsuan <yan12125@gmail.com> | 2015-05-14 23:28:42 +0800 |
---|---|---|
committer | Yen Chi Hsuan <yan12125@gmail.com> | 2015-05-14 23:28:42 +0800 |
commit | 29ea57283e473e94c72cf9cbc065c3c05a14830f (patch) | |
tree | 70b8da37b8f1f753a3a50d0d86287c9e058d93e4 /youtube_dl/extractor/qqmusic.py | |
parent | 548897396158d7822020f45c10301e9ca3c46453 (diff) |
[qqmusic] Refactoring QQMusicToplistIE
Diffstat (limited to 'youtube_dl/extractor/qqmusic.py')
-rw-r--r-- | youtube_dl/extractor/qqmusic.py | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/youtube_dl/extractor/qqmusic.py b/youtube_dl/extractor/qqmusic.py index 5ddbb183e..59e93a1dd 100644 --- a/youtube_dl/extractor/qqmusic.py +++ b/youtube_dl/extractor/qqmusic.py @@ -204,8 +204,7 @@ class QQMusicToplistIE(QQPlaylistBaseIE): def _real_extract(self, url): list_id = self._match_id(url) - list_type = list_id.split("_")[0] - num_id = list_id.split("_")[1] + list_type, num_id = list_id.split("_") list_page = self._download_webpage( "http://y.qq.com/y/static/toplist/index/%s.html" % list_id, @@ -217,11 +216,11 @@ class QQMusicToplistIE(QQPlaylistBaseIE): else: jsonp_url = "http://y.qq.com/y/static/toplist/json/global/%s/1_1.js" % num_id - list = self._download_json( + toplist_json = 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 toplist_json['l']: s = song['s'] song_mid = s.split("|")[20] entries.append(self.url_result( @@ -231,6 +230,5 @@ class QQMusicToplistIE(QQPlaylistBaseIE): list_name = self._html_search_regex( r'<h2 id="top_name">([^\']+)</h2>', list_page, 'top list name', default=None) - list_desc = None - return self.playlist_result(entries, list_id, list_name, list_desc) + return self.playlist_result(entries, list_id, list_name) |