2 from __future__ import unicode_literals
4 from .common import InfoExtractor
5 from ..compat import compat_str
6 from ..utils import unified_strdate
9 class StreetVoiceIE(InfoExtractor):
10 _VALID_URL = r'https?://(?:.+?\.)?streetvoice\.com/[^/]+/songs/(?P<id>[0-9]+)'
12 'url': 'http://streetvoice.com/skippylu/songs/94440/',
13 'md5': '15974627fc01a29e492c98593c2fd472',
18 'description': 'Crispy脆樂團 - 輸',
19 'thumbnail': 're:^https?://.*\.jpg$',
21 'upload_date': '20091018',
22 'uploader': 'Crispy脆樂團',
23 'uploader_id': '627810',
26 'url': 'http://tw.streetvoice.com/skippylu/songs/94440/',
27 'only_matching': True,
30 def _real_extract(self, url):
31 song_id = self._match_id(url)
33 song = self._download_json(
34 'https://streetvoice.com/api/v1/public/song/%s/' % song_id, song_id, data=b'')
37 author = song['user']['nickname']
43 'description': '%s - %s' % (author, title),
44 'thumbnail': self._proto_relative_url(song.get('image'), 'http:'),
45 'duration': song.get('length'),
46 'upload_date': unified_strdate(song.get('created_at')),
48 'uploader_id': compat_str(song['user']['id']),