]> jfr.im git - yt-dlp.git/blame - yt_dlp/extractor/godtube.py
[ie/youtube] Suppress "Unavailable videos are hidden" warning (#10159)
[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):
df773c3d 9 _WORKING = False
cb3ff6fb
S
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',
ec85ded8 23 'thumbnail': r're:^https?://.*\.jpg$',
cb3ff6fb
S
24 },
25 },
26 ]
27
28 def _real_extract(self, url):
5ad28e7f 29 mobj = self._match_valid_url(url)
cb3ff6fb
S
30 video_id = mobj.group('id')
31
32 config = self._download_xml(
add96eb9 33 f'http://www.godtube.com/resource/mediaplayer/{video_id.lower()}.xml',
cb3ff6fb
S
34 video_id, 'Downloading player config XML')
35
2a7b4681
PH
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
cb3ff6fb
S
41
42 media = self._download_xml(
add96eb9 43 f'http://www.godtube.com/media/xml/?v={video_id}', video_id, 'Downloading media XML')
cb3ff6fb 44
2a7b4681 45 title = media.find('title').text
cb3ff6fb
S
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 }