]> jfr.im git - yt-dlp.git/blame - yt_dlp/extractor/godtube.py
[ie/zingmp3] Add support for radio and podcasts (#7189)
[yt-dlp.git] / yt_dlp / extractor / godtube.py
CommitLineData
cb3ff6fb
S
1from .common import InfoExtractor
2from ..utils import (
3 parse_duration,
4 parse_iso8601,
5)
6
7
8class GodTubeIE(InfoExtractor):
9 _VALID_URL = r'https?://(?:www\.)?godtube\.com/watch/\?v=(?P<id>[\da-zA-Z]+)'
10 _TESTS = [
11 {
12 'url': 'https://www.godtube.com/watch/?v=0C0CNNNU',
13 'md5': '77108c1e4ab58f48031101a1a2119789',
14 'info_dict': {
15 'id': '0C0CNNNU',
16 'ext': 'mp4',
17 'title': 'Woman at the well.',
18 'duration': 159,
19 'timestamp': 1205712000,
20 'uploader': 'beverlybmusic',
21 'upload_date': '20080317',
ec85ded8 22 'thumbnail': r're:^https?://.*\.jpg$',
cb3ff6fb
S
23 },
24 },
25 ]
26
27 def _real_extract(self, url):
5ad28e7f 28 mobj = self._match_valid_url(url)
cb3ff6fb
S
29 video_id = mobj.group('id')
30
31 config = self._download_xml(
32 'http://www.godtube.com/resource/mediaplayer/%s.xml' % video_id.lower(),
33 video_id, 'Downloading player config XML')
34
2a7b4681
PH
35 video_url = config.find('file').text
36 uploader = config.find('author').text
37 timestamp = parse_iso8601(config.find('date').text)
38 duration = parse_duration(config.find('duration').text)
39 thumbnail = config.find('image').text
cb3ff6fb
S
40
41 media = self._download_xml(
42 'http://www.godtube.com/media/xml/?v=%s' % video_id, video_id, 'Downloading media XML')
43
2a7b4681 44 title = media.find('title').text
cb3ff6fb
S
45
46 return {
47 'id': video_id,
48 'url': video_url,
49 'title': title,
50 'thumbnail': thumbnail,
51 'timestamp': timestamp,
52 'uploader': uploader,
53 'duration': duration,
54 }