]> jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/godtube.py
[panopto] Add extractors (#2908)
[yt-dlp.git] / yt_dlp / extractor / godtube.py
1 from __future__ import unicode_literals
2
3
4 from .common import InfoExtractor
5 from ..utils import (
6 parse_duration,
7 parse_iso8601,
8 )
9
10
11 class 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',
25 'thumbnail': r're:^https?://.*\.jpg$',
26 },
27 },
28 ]
29
30 def _real_extract(self, url):
31 mobj = self._match_valid_url(url)
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
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
43
44 media = self._download_xml(
45 'http://www.godtube.com/media/xml/?v=%s' % video_id, video_id, 'Downloading media XML')
46
47 title = media.find('title').text
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 }