38 lines
1.3 KiB
Python
Raw Normal View History

2015-10-19 03:36:07 +02:00
# coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
2015-10-19 20:03:03 +02:00
from ..utils import int_or_none
2015-10-19 03:36:07 +02:00
class StitcherIE(InfoExtractor):
2015-10-19 20:03:03 +02:00
_VALID_URL = r'https?://(?:www\.)?stitcher\.com/podcast/[\/a-z\-]+(?P<id>\d+)'
2015-10-19 03:36:07 +02:00
_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):
2015-10-19 17:48:34 +02:00
audio_id = self._match_id(url)
2015-10-19 03:36:07 +02:00
webpage = self._download_webpage(url, audio_id)
title = self._og_search_title(webpage)
2015-10-19 17:48:34 +02:00
url = self._search_regex(r'episodeURL: "(.+?)"', webpage, 'url')
episode_image = self._search_regex(r'episodeImage: "(.+?)"', webpage, 'episode_image', fatal=False)
2015-10-19 20:03:03 +02:00
duration = int_or_none(self._search_regex(r'duration: (\d+?),', webpage, 'duration', fatal=False))
2015-10-19 03:36:07 +02:00
return {
'id': audio_id,
'url': url,
'title': title,
'duration': duration,
'thumbnail': episode_image,
'ext': 'mp3',
'vcodec': 'none',
}