3 from __future__ import unicode_literals
5 from .common import InfoExtractor
8 class TudouPlaylistIE(InfoExtractor):
9 IE_NAME = 'tudou:playlist'
10 _VALID_URL = r'https?://(?:www\.)?tudou\.com/listplay/(?P<id>[\w-]{11})\.html'
12 'url': 'http://www.tudou.com/listplay/zzdE77v6Mmo.html',
16 'playlist_mincount': 209,
19 def _real_extract(self, url):
20 playlist_id = self._match_id(url)
21 playlist_data = self._download_json(
22 'http://www.tudou.com/tvp/plist.action?lcode=%s' % playlist_id, playlist_id)
23 entries = [self.url_result(
24 'http://www.tudou.com/programs/view/%s' % item['icode'],
25 'Tudou', item['icode'],
26 item['kw']) for item in playlist_data['items']]
27 return self.playlist_result(entries, playlist_id)
30 class TudouAlbumIE(InfoExtractor):
31 IE_NAME = 'tudou:album'
32 _VALID_URL = r'https?://(?:www\.)?tudou\.com/album(?:cover|play)/(?P<id>[\w-]{11})'
34 'url': 'http://www.tudou.com/albumplay/v5qckFJvNJg.html',
38 'playlist_mincount': 45,
41 def _real_extract(self, url):
42 album_id = self._match_id(url)
43 album_data = self._download_json(
44 'http://www.tudou.com/tvp/alist.action?acode=%s' % album_id, album_id)
45 entries = [self.url_result(
46 'http://www.tudou.com/programs/view/%s' % item['icode'],
47 'Tudou', item['icode'],
48 item['kw']) for item in album_data['items']]
49 return self.playlist_result(entries, album_id)