3 from .common
import InfoExtractor
4 from ..utils
import try_get
, url_or_none
7 class GoToStageIE(InfoExtractor
):
8 _VALID_URL
= r
'https?://(?:www\.)?gotostage\.com/channel/[a-z0-9]+/recording/(?P<id>[a-z0-9]+)/watch'
10 'url': 'https://www.gotostage.com/channel/8901680603948959494/recording/60bb55548d434f21b9ce4f0e225c4895/watch',
11 'md5': 'ca72ce990cdcd7a2bd152f7217e319a2',
13 'id': '60bb55548d434f21b9ce4f0e225c4895',
15 'title': 'What is GoToStage?',
16 'thumbnail': r
're:^https?://.*\.jpg$',
17 'duration': 93.924711,
20 'url': 'https://www.gotostage.com/channel/bacc3d3535b34bafacc3f4ef8d4df78a/recording/831e74cd3e0042be96defba627b6f676/watch?source=HOMEPAGE',
21 'only_matching': True,
24 def _real_extract(self
, url
):
25 video_id
= self
._match
_id
(url
)
26 metadata
= self
._download
_json
(
27 f
'https://api.gotostage.com/contents?ids={video_id}',
29 note
='Downloading video metadata',
30 errnote
='Unable to download video metadata')[0]
33 'product': metadata
['product'],
34 'resourceType': metadata
['contentType'],
35 'productReferenceKey': metadata
['productRefKey'],
38 'email': 'foobar@example.com',
41 registration_response
= self
._download
_json
(
42 'https://api-registrations.logmeininc.com/registrations',
44 data
=json
.dumps(registration_data
).encode(),
46 headers
={'Content-Type': 'application/json'},
48 errnote
='Unable to register user')
50 content_response
= self
._download
_json
(
51 f
'https://api.gotostage.com/contents/{video_id}/asset',
53 headers
={'x-registrantkey': registration_response
['registrationKey']},
54 note
='Get download url',
55 errnote
='Unable to get download url')
59 'title': try_get(metadata
, lambda x
: x
['title'], str),
60 'url': try_get(content_response
, lambda x
: x
['cdnLocation'], str),
62 'thumbnail': url_or_none(try_get(metadata
, lambda x
: x
['thumbnail']['location'])),
63 'duration': try_get(metadata
, lambda x
: x
['duration'], float),
64 'categories': [try_get(metadata
, lambda x
: x
['category'], str)],