1 from .common
import InfoExtractor
2 from ..compat
import compat_str
11 class GoToStageIE(InfoExtractor
):
12 _VALID_URL
= r
'https?://(?:www\.)?gotostage\.com/channel/[a-z0-9]+/recording/(?P<id>[a-z0-9]+)/watch'
14 'url': 'https://www.gotostage.com/channel/8901680603948959494/recording/60bb55548d434f21b9ce4f0e225c4895/watch',
15 'md5': 'ca72ce990cdcd7a2bd152f7217e319a2',
17 'id': '60bb55548d434f21b9ce4f0e225c4895',
19 'title': 'What is GoToStage?',
20 'thumbnail': r
're:^https?://.*\.jpg$',
24 'url': 'https://www.gotostage.com/channel/bacc3d3535b34bafacc3f4ef8d4df78a/recording/831e74cd3e0042be96defba627b6f676/watch?source=HOMEPAGE',
25 'only_matching': True,
28 def _real_extract(self
, url
):
29 video_id
= self
._match
_id
(url
)
30 metadata
= self
._download
_json
(
31 'https://api.gotostage.com/contents?ids=%s' % video_id
,
33 note
='Downloading video metadata',
34 errnote
='Unable to download video metadata')[0]
37 'product': metadata
['product'],
38 'resourceType': metadata
['contentType'],
39 'productReferenceKey': metadata
['productRefKey'],
42 'email': 'foobar@example.com'
45 registration_response
= self
._download
_json
(
46 'https://api-registrations.logmeininc.com/registrations',
48 data
=json
.dumps(registration_data
).encode(),
50 headers
={'Content-Type': 'application/json'}
,
52 errnote
='Unable to register user')
54 content_response
= self
._download
_json
(
55 'https://api.gotostage.com/contents/%s/asset' % video_id
,
57 headers
={'x-registrantkey': registration_response['registrationKey']}
,
58 note
='Get download url',
59 errnote
='Unable to get download url')
63 'title': try_get(metadata
, lambda x
: x
['title'], compat_str
),
64 'url': try_get(content_response
, lambda x
: x
['cdnLocation'], compat_str
),
66 'thumbnail': url_or_none(try_get(metadata
, lambda x
: x
['thumbnail']['location'])),
67 'duration': try_get(metadata
, lambda x
: x
['duration'], float),
68 'categories': [try_get(metadata
, lambda x
: x
['category'], compat_str
)],