Browse Source

Merge branch 'ping-qqmusic-playlist'

totalwebcasting
Yen Chi Hsuan 10 years ago
parent
commit
da839880e9
2 changed files with 35 additions and 0 deletions
  1. +1
    -0
      youtube_dl/extractor/__init__.py
  2. +34
    -0
      youtube_dl/extractor/qqmusic.py

+ 1
- 0
youtube_dl/extractor/__init__.py View File

@ -432,6 +432,7 @@ from .qqmusic import (
QQMusicSingerIE, QQMusicSingerIE,
QQMusicAlbumIE, QQMusicAlbumIE,
QQMusicToplistIE, QQMusicToplistIE,
QQMusicPlaylistIE,
) )
from .quickvid import QuickVidIE from .quickvid import QuickVidIE
from .r7 import R7IE from .r7 import R7IE


+ 34
- 0
youtube_dl/extractor/qqmusic.py View File

@ -9,6 +9,7 @@ from .common import InfoExtractor
from ..utils import ( from ..utils import (
strip_jsonp, strip_jsonp,
unescapeHTML, unescapeHTML,
clean_html,
) )
from ..compat import compat_urllib_request from ..compat import compat_urllib_request
@ -243,3 +244,36 @@ class QQMusicToplistIE(QQPlaylistBaseIE):
list_name = topinfo.get('ListName') list_name = topinfo.get('ListName')
list_description = topinfo.get('info') list_description = topinfo.get('info')
return self.playlist_result(entries, list_id, list_name, list_description) return self.playlist_result(entries, list_id, list_name, list_description)
class QQMusicPlaylistIE(QQPlaylistBaseIE):
IE_NAME = 'qqmusic:playlist'
_VALID_URL = r'http://y\.qq\.com/#type=taoge&id=(?P<id>[0-9]+)'
_TEST = {
'url': 'http://y.qq.com/#type=taoge&id=3462654915',
'info_dict': {
'id': '3462654915',
'title': '韩国5月新歌精选下旬',
'description': 'md5:d2c9d758a96b9888cf4fe82f603121d4',
},
'playlist_count': 40,
}
def _real_extract(self, url):
list_id = self._match_id(url)
list_json = self._download_json(
'http://i.y.qq.com/qzone-music/fcg-bin/fcg_ucc_getcdinfo_byids_cp.fcg?type=1&json=1&utf8=1&onlysong=0&disstid=%s'
% list_id, list_id, 'Download list page',
transform_source=strip_jsonp)['cdlist'][0]
entries = [
self.url_result(
'http://y.qq.com/#type=song&mid=' + song['songmid'], 'QQMusic', song['songmid']
) for song in list_json['songlist']
]
list_name = list_json.get('dissname')
list_description = clean_html(unescapeHTML(list_json.get('desc')))
return self.playlist_result(entries, list_id, list_name, list_description)

Loading…
Cancel
Save