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