1
0
Fork 0
mirror of https://github.com/ytdl-org/youtube-dl.git synced 2024-11-23 10:41:52 +00:00

Merge branch 'ping-qqmusic-album-fix'

This commit is contained in:
Yen Chi Hsuan 2015-07-06 17:09:56 +08:00
commit 92b2f18072

View file

@ -164,31 +164,40 @@ class QQMusicAlbumIE(QQPlaylistBaseIE):
IE_NAME = 'qqmusic:album' IE_NAME = 'qqmusic:album'
_VALID_URL = r'http://y.qq.com/#type=album&mid=(?P<id>[0-9A-Za-z]+)' _VALID_URL = r'http://y.qq.com/#type=album&mid=(?P<id>[0-9A-Za-z]+)'
_TEST = { _TESTS = [{
'url': 'http://y.qq.com/#type=album&mid=000gXCTb2AhRR1&play=0', 'url': 'http://y.qq.com/#type=album&mid=000gXCTb2AhRR1',
'info_dict': { 'info_dict': {
'id': '000gXCTb2AhRR1', 'id': '000gXCTb2AhRR1',
'title': '我们都是这样长大的', 'title': '我们都是这样长大的',
'description': 'md5:d216c55a2d4b3537fe4415b8767d74d6', 'description': 'md5:179c5dce203a5931970d306aa9607ea6',
}, },
'playlist_count': 4, 'playlist_count': 4,
} }, {
'url': 'http://y.qq.com/#type=album&mid=002Y5a3b3AlCu3',
'info_dict': {
'id': '002Y5a3b3AlCu3',
'title': '그리고...',
'description': 'md5:a48823755615508a95080e81b51ba729',
},
'playlist_count': 8,
}]
def _real_extract(self, url): def _real_extract(self, url):
mid = self._match_id(url) mid = self._match_id(url)
album_page = self._download_webpage( album = self._download_json(
self.qq_static_url('album', mid), mid, 'Download album page') 'http://i.y.qq.com/v8/fcg-bin/fcg_v8_album_info_cp.fcg?albummid=%s&format=json' % mid,
mid, 'Download album page')['data']
entries = self.get_entries_from_page(album_page) entries = [
self.url_result(
album_name = self._html_search_regex( 'http://y.qq.com/#type=song&mid=' + song['songmid'], 'QQMusic', song['songmid']
r"albumname\s*:\s*'([^']+)',", album_page, 'album name', ) for song in album['list']
default=None) ]
album_name = album.get('name')
album_detail = self._html_search_regex( album_detail = album.get('desc')
r'<div class="album_detail close_detail">\s*<p>((?:[^<>]+(?:<br />)?)+)</p>', if album_detail is not None:
album_page, 'album details', default=None) album_detail = album_detail.strip()
return self.playlist_result(entries, mid, album_name, album_detail) return self.playlist_result(entries, mid, album_name, album_detail)