diff options
author | Yen Chi Hsuan <yan12125@gmail.com> | 2015-01-21 23:05:47 +0800 |
---|---|---|
committer | Yen Chi Hsuan <yan12125@gmail.com> | 2015-01-21 23:05:47 +0800 |
commit | c8dc41a6e7eea2a1235238cfeadb4caf5619d0ae (patch) | |
tree | 53467ef8bb7482f08ef2354b8544e061137b6b19 /youtube_dl/extractor/streetvoice.py | |
parent | 47e0e1e0e2306dd7119844bbbc3ef39ccb175ed1 (diff) |
[StreetVoice] Add new extractor
Diffstat (limited to 'youtube_dl/extractor/streetvoice.py')
-rw-r--r-- | youtube_dl/extractor/streetvoice.py | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/youtube_dl/extractor/streetvoice.py b/youtube_dl/extractor/streetvoice.py new file mode 100644 index 000000000..55ceea75b --- /dev/null +++ b/youtube_dl/extractor/streetvoice.py @@ -0,0 +1,36 @@ +# coding: utf-8 +from __future__ import unicode_literals + +from .common import InfoExtractor + + +class StreetVoiceIE(InfoExtractor): + _VALID_URL = r'http://tw.streetvoice.com/[^/]+/songs/(?P<id>[0-9]+)/' + _TESTS = [ + { + 'url': 'http://tw.streetvoice.com/skippylu/songs/94440/', + 'md5': '15974627fc01a29e492c98593c2fd472', + 'info_dict': { + 'id': '94440', + 'ext': 'mp3', + 'title': '輸', + 'description': '輸 - Crispy脆樂團' + } + } + ] + + def _real_extract(self, url): + song_id = self._match_id(url) + + api_url = 'http://tw.streetvoice.com/music/api/song/%s/' % song_id + info_dict = self._download_json(api_url, song_id) + + author = info_dict['musician']['name'] + title = info_dict['name'] + return { + 'id': song_id, + 'ext': 'mp3', + 'title': title, + 'url': info_dict['file'], + 'description': '%s - %s' % (title, author) + } |