1
0
mirror of https://github.com/l1ving/youtube-dl synced 2025-01-28 03:33:22 +08:00

Stitcher review updates

This commit is contained in:
mjdubell 2015-10-19 20:03:03 +02:00
parent 2bfb394b1b
commit 5d46ddec7d

View File

@ -1,10 +1,11 @@
# coding: utf-8 # coding: utf-8
from __future__ import unicode_literals from __future__ import unicode_literals
from .common import InfoExtractor from .common import InfoExtractor
from ..utils import int_or_none
class StitcherIE(InfoExtractor): class StitcherIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?stitcher\.com/podcast/[\/a-z\-]+(?P<id>\d+)|\?[a-z=]+' _VALID_URL = r'https?://(?:www\.)?stitcher\.com/podcast/[\/a-z\-]+(?P<id>\d+)'
_TEST = { _TEST = {
'url': 'http://www.stitcher.com/podcast/the-talking-machines/e/40789481?autoplay=true', 'url': 'http://www.stitcher.com/podcast/the-talking-machines/e/40789481?autoplay=true',
'md5': '391dd4e021e6edeb7b8e68fbf2e9e940', 'md5': '391dd4e021e6edeb7b8e68fbf2e9e940',
@ -23,7 +24,7 @@ class StitcherIE(InfoExtractor):
title = self._og_search_title(webpage) title = self._og_search_title(webpage)
url = self._search_regex(r'episodeURL: "(.+?)"', webpage, 'url') url = self._search_regex(r'episodeURL: "(.+?)"', webpage, 'url')
episode_image = self._search_regex(r'episodeImage: "(.+?)"', webpage, 'episode_image', fatal=False) episode_image = self._search_regex(r'episodeImage: "(.+?)"', webpage, 'episode_image', fatal=False)
duration = self._search_regex(r'simpleDuration: "(\d+?) minutes"', webpage, 'duration', fatal=False) duration = int_or_none(self._search_regex(r'duration: (\d+?),', webpage, 'duration', fatal=False))
return { return {
'id': audio_id, 'id': audio_id,