about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSergey M. <dstftw@gmail.com>2015-01-21 22:36:50 +0600
committerSergey M. <dstftw@gmail.com>2015-01-21 22:36:50 +0600
commitd63528c8c7965545969e77b983e0e42d2e41e31f (patch)
tree87c7bcabbe6d67656905a3500d209a43bc0527bb
parentc5db6bb32ba708bc5c92a68487b07be2374f416d (diff)
parentc8dc41a6e7eea2a1235238cfeadb4caf5619d0ae (diff)
downloadyoutube-dl-d63528c8c7965545969e77b983e0e42d2e41e31f.tar.gz
youtube-dl-d63528c8c7965545969e77b983e0e42d2e41e31f.tar.xz
youtube-dl-d63528c8c7965545969e77b983e0e42d2e41e31f.zip
Merge pull request #4758 from yan12125/IE_streetvoice
[StreetVoice] Add new extractor
-rw-r--r--youtube_dl/extractor/__init__.py1
-rw-r--r--youtube_dl/extractor/streetvoice.py36
2 files changed, 37 insertions, 0 deletions
diff --git a/youtube_dl/extractor/__init__.py b/youtube_dl/extractor/__init__.py
index 0b0f3be19..c41f2de0f 100644
--- a/youtube_dl/extractor/__init__.py
+++ b/youtube_dl/extractor/__init__.py
@@ -409,6 +409,7 @@ from .stanfordoc import StanfordOpenClassroomIE
 from .steam import SteamIE
 from .streamcloud import StreamcloudIE
 from .streamcz import StreamCZIE
+from .streetvoice import StreetVoiceIE
 from .sunporno import SunPornoIE
 from .swrmediathek import SWRMediathekIE
 from .syfy import SyfyIE
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)
+        }