aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/extractor/stitcher.py
diff options
context:
space:
mode:
authormjdubell <localhost@localhost>2015-10-19 03:36:07 +0200
committerSergey M․ <dstftw@gmail.com>2015-10-20 23:11:26 +0600
commit4211c83aa4dec0cf9874a6a485665360570e2a89 (patch)
treea6dfc5ef2f0c1cc3460d39a4efa06978131e5f4a /youtube_dl/extractor/stitcher.py
parentd01949dc89feb2441f251e42e8a6bfa4711b9715 (diff)
[stitcher] Add extractor
Stitcher review updates Removed re import Stitcher review updates
Diffstat (limited to 'youtube_dl/extractor/stitcher.py')
-rw-r--r--youtube_dl/extractor/stitcher.py37
1 files changed, 37 insertions, 0 deletions
diff --git a/youtube_dl/extractor/stitcher.py b/youtube_dl/extractor/stitcher.py
new file mode 100644
index 000000000..a547debbd
--- /dev/null
+++ b/youtube_dl/extractor/stitcher.py
@@ -0,0 +1,37 @@
+# coding: utf-8
+from __future__ import unicode_literals
+from .common import InfoExtractor
+from ..utils import int_or_none
+
+
+class StitcherIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?stitcher\.com/podcast/[\/a-z\-]+(?P<id>\d+)'
+ _TEST = {
+ 'url': 'http://www.stitcher.com/podcast/the-talking-machines/e/40789481?autoplay=true',
+ 'md5': '391dd4e021e6edeb7b8e68fbf2e9e940',
+ 'info_dict': {
+ 'id': '40789481',
+ 'ext': 'mp3',
+ 'title': 'Machine Learning Mastery and Cancer Clusters from Talking Machines',
+ }
+ }
+
+ def _real_extract(self, url):
+ audio_id = self._match_id(url)
+
+ webpage = self._download_webpage(url, audio_id)
+
+ title = self._og_search_title(webpage)
+ url = self._search_regex(r'episodeURL: "(.+?)"', webpage, 'url')
+ episode_image = self._search_regex(r'episodeImage: "(.+?)"', webpage, 'episode_image', fatal=False)
+ duration = int_or_none(self._search_regex(r'duration: (\d+?),', webpage, 'duration', fatal=False))
+
+ return {
+ 'id': audio_id,
+ 'url': url,
+ 'title': title,
+ 'duration': duration,
+ 'thumbnail': episode_image,
+ 'ext': 'mp3',
+ 'vcodec': 'none',
+ }