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

[kuwo] Simpler calls to url_result()

This commit is contained in:
Yen Chi Hsuan 2015-07-10 23:53:48 +08:00
parent cf2c5fda4f
commit d3b8908886

View file

@ -142,9 +142,8 @@ class KuwoAlbumIE(InfoExtractor):
'%s简介:' % album_name) '%s简介:' % album_name)
entries = [ entries = [
self.url_result('http://www.kuwo.cn/yinyue/%s/' % song_id, 'Kuwo', song_id) self.url_result(song_url, 'Kuwo') for song_url in re.findall(
for song_id in re.findall( r'<p[^>]+class="listen"><a[^>]+href="(http://www\.kuwo\.cn/yinyue/\d+/)"',
r'<p[^>]+class="listen"><a[^>]+href="http://www\.kuwo\.cn/yinyue/(\d+)/"',
webpage) webpage)
] ]
return self.playlist_result(entries, album_id, album_name, album_intro) return self.playlist_result(entries, album_id, album_name, album_intro)
@ -176,9 +175,8 @@ class KuwoChartIE(InfoExtractor):
r'<p[^>]+class="tabDef">(\d{4}\d{2}期)</p>', webpage, 'chart desc') r'<p[^>]+class="tabDef">(\d{4}\d{2}期)</p>', webpage, 'chart desc')
entries = [ entries = [
self.url_result('http://www.kuwo.cn/yinyue/%s/' % song_id, 'Kuwo', song_id) self.url_result(song_url, 'Kuwo') for song_url in re.findall(
for song_id in re.findall( r'<a[^>]+href="(http://www\.kuwo\.cn/yinyue/\d+)/"', webpage)
r'<a[^>]+href="http://www\.kuwo\.cn/yinyue/(\d+)/"', webpage)
] ]
return self.playlist_result(entries, chart_id, chart_name, chart_desc) return self.playlist_result(entries, chart_id, chart_name, chart_desc)
@ -221,9 +219,8 @@ class KuwoSingerIE(InfoExtractor):
errnote='Unable to get song list page #%d' % page_num) errnote='Unable to get song list page #%d' % page_num)
entries.extend([ entries.extend([
self.url_result('http://www.kuwo.cn/yinyue/%s/' % song_id, 'Kuwo', song_id) self.url_result(song_url, 'Kuwo') for song_url in re.findall(
for song_id in re.findall( r'<p[^>]+class="m_name"><a[^>]+href="(http://www\.kuwo\.cn/yinyue/\d+)/',
r'<p[^>]+class="m_name"><a[^>]+href="http://www\.kuwo\.cn/yinyue/([0-9]+)/',
webpage) webpage)
][:10 if first_page_only else None]) ][:10 if first_page_only else None])
@ -263,9 +260,7 @@ class KuwoCategoryIE(InfoExtractor):
r'var\s+jsonm\s*=\s*([^;]+);', webpage, 'category songs'), category_id) r'var\s+jsonm\s*=\s*([^;]+);', webpage, 'category songs'), category_id)
entries = [ entries = [
self.url_result( self.url_result('http://www.kuwo.cn/yinyue/%s/' % song['musicrid'], 'Kuwo')
'http://www.kuwo.cn/yinyue/%s/' % song['musicrid'],
'Kuwo', song['musicrid'])
for song in jsonm['musiclist'] for song in jsonm['musiclist']
] ]
return self.playlist_result(entries, category_id, category_name, category_desc) return self.playlist_result(entries, category_id, category_name, category_desc)