mirror of
https://github.com/l1ving/youtube-dl
synced 2024-11-24 12:42:53 +08:00
[podomatic] Improve video URL extraction (Closes #2763)
This commit is contained in:
parent
f270256e06
commit
e6c6d10d99
@ -6,22 +6,36 @@ import re
|
|||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..utils import int_or_none
|
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'^(?P<proto>https?)://(?P<channel>[^.]+)\.podomatic\.com/entry/(?P<id>[^?]+)'
|
||||||
|
|
||||||
_TEST = {
|
_TESTS = [
|
||||||
"url": "http://scienceteachingtips.podomatic.com/entry/2009-01-02T16_03_35-08_00",
|
{
|
||||||
"file": "2009-01-02T16_03_35-08_00.mp3",
|
'url': 'http://scienceteachingtips.podomatic.com/entry/2009-01-02T16_03_35-08_00',
|
||||||
"md5": "84bb855fcf3429e6bf72460e1eed782d",
|
'md5': '84bb855fcf3429e6bf72460e1eed782d',
|
||||||
"info_dict": {
|
'info_dict': {
|
||||||
"uploader": "Science Teaching Tips",
|
'id': '2009-01-02T16_03_35-08_00',
|
||||||
"uploader_id": "scienceteachingtips",
|
'ext': 'mp3',
|
||||||
"title": "64. When the Moon Hits Your Eye",
|
'uploader': 'Science Teaching Tips',
|
||||||
"duration": 446,
|
'uploader_id': 'scienceteachingtips',
|
||||||
|
'title': '64. When the Moon Hits Your Eye',
|
||||||
|
'duration': 446,
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'url': 'http://ostbahnhof.podomatic.com/entry/2013-11-15T16_31_21-08_00',
|
||||||
|
'md5': 'd2cf443931b6148e27638650e2638297',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '2013-11-15T16_31_21-08_00',
|
||||||
|
'ext': 'mp3',
|
||||||
|
'uploader': 'Ostbahnhof / Techno Mix',
|
||||||
|
'uploader_id': 'ostbahnhof',
|
||||||
|
'title': 'Einunddreizig',
|
||||||
|
'duration': 3799,
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
mobj = re.match(self._VALID_URL, url)
|
mobj = re.match(self._VALID_URL, url)
|
||||||
@ -32,10 +46,12 @@ class PodomaticIE(InfoExtractor):
|
|||||||
'?permalink=true&rtmp=0') %
|
'?permalink=true&rtmp=0') %
|
||||||
(mobj.group('proto'), channel, video_id))
|
(mobj.group('proto'), channel, video_id))
|
||||||
data_json = self._download_webpage(
|
data_json = self._download_webpage(
|
||||||
json_url, video_id, note=u'Downloading video info')
|
json_url, video_id, 'Downloading video info')
|
||||||
data = json.loads(data_json)
|
data = json.loads(data_json)
|
||||||
|
|
||||||
video_url = data['downloadLink']
|
video_url = data['downloadLink']
|
||||||
|
if not video_url:
|
||||||
|
video_url = '%s/%s' % (data['streamer'].replace('rtmp', 'http'), data['mediaLocation'])
|
||||||
uploader = data['podcast']
|
uploader = data['podcast']
|
||||||
title = data['title']
|
title = data['title']
|
||||||
thumbnail = data['imageLocation']
|
thumbnail = data['imageLocation']
|
||||||
|
Loading…
Reference in New Issue
Block a user