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