]>
jfr.im git - yt-dlp.git/blob - youtube_dl/extractor/ustudio.py
1 from __future__
import unicode_literals
5 from .common
import InfoExtractor
12 class UstudioIE(InfoExtractor
):
13 _VALID_URL
= r
'https?://(?:(?:www|v1)\.)?ustudio\.com/video/(?P<id>[^/]+)/(?P<display_id>[^/?#&]+)'
15 'url': 'http://ustudio.com/video/Uxu2my9bgSph/san_francisco_golden_gate_bridge',
16 'md5': '58bbfca62125378742df01fc2abbdef6',
19 'display_id': 'san_francisco_golden_gate_bridge',
21 'title': 'San Francisco: Golden Gate Bridge',
22 'description': 'md5:23925500697f2c6d4830e387ba51a9be',
23 'thumbnail': 're:^https?://.*\.jpg$',
24 'upload_date': '20111107',
25 'uploader': 'Tony Farley',
29 def _real_extract(self
, url
):
30 mobj
= re
.match(self
._VALID
_URL
, url
)
31 video_id
= mobj
.group('id')
32 display_id
= mobj
.group('display_id')
34 config
= self
._download
_xml
(
35 'http://v1.ustudio.com/embed/%s/ustudio/config.xml' % video_id
,
40 'url': item
.attrib
['url'],
41 'width': int_or_none(item
.get('width')),
42 'height': int_or_none(item
.get('height')),
43 } for item
in config
.findall('./qualities/quality/%s' % kind
) if item
.get('url')]
45 formats
= extract('video')
46 self
._sort
_formats
(formats
)
48 webpage
= self
._download
_webpage
(url
, display_id
)
50 title
= self
._og
_search
_title
(webpage
)
51 upload_date
= unified_strdate(self
._search
_regex
(
52 r
'(?s)Uploaded by\s*.+?\s*on\s*<span>([^<]+)</span>',
53 webpage
, 'upload date', fatal
=False))
54 uploader
= self
._search
_regex
(
55 r
'Uploaded by\s*<a[^>]*>([^<]+)<',
56 webpage
, 'uploader', fatal
=False)
60 'display_id': display_id
,
62 'description': self
._og
_search
_description
(webpage
),
63 'thumbnails': extract('image'),
64 'upload_date': upload_date
,