1
0
mirror of https://codeberg.org/polarisfm/youtube-dl synced 2024-11-26 10:24:33 +01:00

[podomatic] Extend _VALID_URL (closes #13827)

This commit is contained in:
Sergey M․ 2017-08-05 08:28:12 +07:00
parent c983cc3b71
commit 1d5472290f
No known key found for this signature in database
GPG Key ID: 2C393E0F18A9236D

View File

@ -9,10 +9,16 @@ from ..utils import int_or_none
class PodomaticIE(InfoExtractor): class PodomaticIE(InfoExtractor):
IE_NAME = 'podomatic' IE_NAME = 'podomatic'
_VALID_URL = r'^(?P<proto>https?)://(?P<channel>[^.]+)\.podomatic\.com/entry/(?P<id>[^?]+)' _VALID_URL = r'''(?x)
(?P<proto>https?)://
(?:
(?P<channel>[^.]+)\.podomatic\.com/entry|
(?:www\.)?podomatic\.com/podcasts/(?P<channel_2>[^/]+)/episodes
)/
(?P<id>[^/?#&]+)
'''
_TESTS = [ _TESTS = [{
{
'url': 'http://scienceteachingtips.podomatic.com/entry/2009-01-02T16_03_35-08_00', 'url': 'http://scienceteachingtips.podomatic.com/entry/2009-01-02T16_03_35-08_00',
'md5': '84bb855fcf3429e6bf72460e1eed782d', 'md5': '84bb855fcf3429e6bf72460e1eed782d',
'info_dict': { 'info_dict': {
@ -23,8 +29,7 @@ class PodomaticIE(InfoExtractor):
'title': '64. When the Moon Hits Your Eye', 'title': '64. When the Moon Hits Your Eye',
'duration': 446, 'duration': 446,
} }
}, }, {
{
'url': 'http://ostbahnhof.podomatic.com/entry/2013-11-15T16_31_21-08_00', 'url': 'http://ostbahnhof.podomatic.com/entry/2013-11-15T16_31_21-08_00',
'md5': 'd2cf443931b6148e27638650e2638297', 'md5': 'd2cf443931b6148e27638650e2638297',
'info_dict': { 'info_dict': {
@ -35,13 +40,15 @@ class PodomaticIE(InfoExtractor):
'title': 'Einunddreizig', 'title': 'Einunddreizig',
'duration': 3799, 'duration': 3799,
} }
}, }, {
] 'url': 'https://www.podomatic.com/podcasts/scienceteachingtips/episodes/2009-01-02T16_03_35-08_00',
'only_matching': True,
}]
def _real_extract(self, url): def _real_extract(self, url):
mobj = re.match(self._VALID_URL, url) mobj = re.match(self._VALID_URL, url)
video_id = mobj.group('id') video_id = mobj.group('id')
channel = mobj.group('channel') channel = mobj.group('channel') or mobj.group('channel_2')
json_url = (('%s://%s.podomatic.com/entry/embed_params/%s' + json_url = (('%s://%s.podomatic.com/entry/embed_params/%s' +
'?permalink=true&rtmp=0') % '?permalink=true&rtmp=0') %