1 from .common
import InfoExtractor
9 class UstudioIE(InfoExtractor
):
11 _VALID_URL
= r
'https?://(?:(?:www|v1)\.)?ustudio\.com/video/(?P<id>[^/]+)/(?P<display_id>[^/?#&]+)'
13 'url': 'http://ustudio.com/video/Uxu2my9bgSph/san_francisco_golden_gate_bridge',
14 'md5': '58bbfca62125378742df01fc2abbdef6',
17 'display_id': 'san_francisco_golden_gate_bridge',
19 'title': 'San Francisco: Golden Gate Bridge',
20 'description': 'md5:23925500697f2c6d4830e387ba51a9be',
21 'thumbnail': r
're:^https?://.*\.jpg$',
22 'upload_date': '20111107',
23 'uploader': 'Tony Farley',
27 def _real_extract(self
, url
):
28 video_id
, display_id
= self
._match
_valid
_url
(url
).groups()
30 config
= self
._download
_xml
(
31 'http://v1.ustudio.com/embed/%s/ustudio/config.xml' % video_id
,
36 'url': unescapeHTML(item
.attrib
['url']),
37 'width': int_or_none(item
.get('width')),
38 'height': int_or_none(item
.get('height')),
39 } for item
in config
.findall('./qualities/quality/%s' % kind
) if item
.get('url')]
41 formats
= extract('video')
43 webpage
= self
._download
_webpage
(url
, display_id
)
45 title
= self
._og
_search
_title
(webpage
)
46 upload_date
= unified_strdate(self
._search
_regex
(
47 r
'(?s)Uploaded by\s*.+?\s*on\s*<span>([^<]+)</span>',
48 webpage
, 'upload date', fatal
=False))
49 uploader
= self
._search
_regex
(
50 r
'Uploaded by\s*<a[^>]*>([^<]+)<',
51 webpage
, 'uploader', fatal
=False)
55 'display_id': display_id
,
57 'description': self
._og
_search
_description
(webpage
),
58 'thumbnails': extract('image'),
59 'upload_date': upload_date
,
65 class UstudioEmbedIE(InfoExtractor
):
66 IE_NAME
= 'ustudio:embed'
67 _VALID_URL
= r
'https?://(?:(?:app|embed)\.)?ustudio\.com/embed/(?P<uid>[^/]+)/(?P<id>[^/]+)'
69 'url': 'http://app.ustudio.com/embed/DeN7VdYRDKhP/Uw7G1kMCe65T',
70 'md5': '47c0be52a09b23a7f40de9469cec58f4',
74 'title': '5 Things IT Should Know About Video',
75 'description': 'md5:93d32650884b500115e158c5677d25ad',
76 'uploader_id': 'DeN7VdYRDKhP',
80 def _real_extract(self
, url
):
81 uploader_id
, video_id
= self
._match
_valid
_url
(url
).groups()
82 video_data
= self
._download
_json
(
83 'http://app.ustudio.com/embed/%s/%s/config.json' % (uploader_id
, video_id
),
84 video_id
)['videos'][0]
85 title
= video_data
['name']
88 for ext
, qualities
in video_data
.get('transcodes', {}).items():
89 for quality
in qualities
:
90 quality_url
= quality
.get('url')
93 height
= int_or_none(quality
.get('height'))
95 'format_id': '%s-%dp' % (ext
, height
) if height
else ext
,
97 'width': int_or_none(quality
.get('width')),
102 for image
in video_data
.get('images', []):
103 image_url
= image
.get('url')
113 'description': video_data
.get('description'),
114 'duration': int_or_none(video_data
.get('duration')),
115 'uploader_id': uploader_id
,
116 'tags': video_data
.get('keywords'),
117 'thumbnails': thumbnails
,