2013-11-29 03:33:25 +01:00
|
|
|
import json
|
|
|
|
|
|
|
|
from .common import InfoExtractor
|
2014-02-24 17:31:09 +01:00
|
|
|
from ..utils import int_or_none
|
2013-11-29 03:33:25 +01:00
|
|
|
|
2014-11-23 20:41:03 +01:00
|
|
|
|
2013-11-29 03:33:25 +01:00
|
|
|
class PodomaticIE(InfoExtractor):
|
2024-03-09 01:02:45 +01:00
|
|
|
_WORKING = False
|
2013-11-29 03:33:25 +01:00
|
|
|
IE_NAME = 'podomatic'
|
2017-08-05 03:28:12 +02:00
|
|
|
_VALID_URL = r'''(?x)
|
|
|
|
(?P<proto>https?)://
|
|
|
|
(?:
|
|
|
|
(?P<channel>[^.]+)\.podomatic\.com/entry|
|
|
|
|
(?:www\.)?podomatic\.com/podcasts/(?P<channel_2>[^/]+)/episodes
|
|
|
|
)/
|
|
|
|
(?P<id>[^/?#&]+)
|
|
|
|
'''
|
2013-11-29 03:33:25 +01:00
|
|
|
|
2017-08-05 03:28:12 +02:00
|
|
|
_TESTS = [{
|
|
|
|
'url': 'http://scienceteachingtips.podomatic.com/entry/2009-01-02T16_03_35-08_00',
|
|
|
|
'md5': '84bb855fcf3429e6bf72460e1eed782d',
|
|
|
|
'info_dict': {
|
|
|
|
'id': '2009-01-02T16_03_35-08_00',
|
|
|
|
'ext': 'mp3',
|
|
|
|
'uploader': 'Science Teaching Tips',
|
|
|
|
'uploader_id': 'scienceteachingtips',
|
|
|
|
'title': '64. When the Moon Hits Your Eye',
|
|
|
|
'duration': 446,
|
2024-06-12 01:09:58 +02:00
|
|
|
},
|
2017-08-05 03:28:12 +02:00
|
|
|
}, {
|
|
|
|
'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,
|
2024-06-12 01:09:58 +02:00
|
|
|
},
|
2017-08-05 03:28:12 +02:00
|
|
|
}, {
|
|
|
|
'url': 'https://www.podomatic.com/podcasts/scienceteachingtips/episodes/2009-01-02T16_03_35-08_00',
|
|
|
|
'only_matching': True,
|
|
|
|
}]
|
2013-11-29 03:33:25 +01:00
|
|
|
|
|
|
|
def _real_extract(self, url):
|
2021-08-19 03:41:24 +02:00
|
|
|
mobj = self._match_valid_url(url)
|
2013-11-29 03:33:25 +01:00
|
|
|
video_id = mobj.group('id')
|
2017-08-05 03:28:12 +02:00
|
|
|
channel = mobj.group('channel') or mobj.group('channel_2')
|
2013-11-29 03:33:25 +01:00
|
|
|
|
2024-06-12 01:09:58 +02:00
|
|
|
json_url = ('{}://{}.podomatic.com/entry/embed_params/{}?permalink=true&rtmp=0'.format(
|
|
|
|
mobj.group('proto'), channel, video_id))
|
2013-11-29 03:33:25 +01:00
|
|
|
data_json = self._download_webpage(
|
2014-04-17 14:59:52 +02:00
|
|
|
json_url, video_id, 'Downloading video info')
|
2013-11-29 03:33:25 +01:00
|
|
|
data = json.loads(data_json)
|
|
|
|
|
|
|
|
video_url = data['downloadLink']
|
2014-04-17 14:59:52 +02:00
|
|
|
if not video_url:
|
2024-06-12 01:09:58 +02:00
|
|
|
video_url = '{}/{}'.format(data['streamer'].replace('rtmp', 'http'), data['mediaLocation'])
|
2013-11-29 03:33:25 +01:00
|
|
|
uploader = data['podcast']
|
|
|
|
title = data['title']
|
|
|
|
thumbnail = data['imageLocation']
|
2014-02-24 17:31:09 +01:00
|
|
|
duration = int_or_none(data.get('length'), 1000)
|
2013-11-29 03:33:25 +01:00
|
|
|
|
|
|
|
return {
|
|
|
|
'id': video_id,
|
|
|
|
'url': video_url,
|
|
|
|
'title': title,
|
|
|
|
'uploader': uploader,
|
|
|
|
'uploader_id': channel,
|
|
|
|
'thumbnail': thumbnail,
|
|
|
|
'duration': duration,
|
|
|
|
}
|