mirror of
https://codeberg.org/polarisfm/youtube-dl
synced 2024-11-26 02:14:32 +01:00
Fixed coding styles
This commit is contained in:
parent
58a8f8b059
commit
a7170b6244
@ -2,6 +2,10 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
|
from ..compat import compat_str
|
||||||
|
from ..utils import (
|
||||||
|
url_or_none,
|
||||||
|
try_get)
|
||||||
|
|
||||||
import json
|
import json
|
||||||
|
|
||||||
@ -16,6 +20,7 @@ class GoToStageIE(InfoExtractor):
|
|||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'title': 'What is GoToStage?',
|
'title': 'What is GoToStage?',
|
||||||
'thumbnail': r're:^https?://.*\.jpg$',
|
'thumbnail': r're:^https?://.*\.jpg$',
|
||||||
|
'duration': 93.924711
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
'url': 'https://www.gotostage.com/channel/bacc3d3535b34bafacc3f4ef8d4df78a/recording/831e74cd3e0042be96defba627b6f676/watch?source=HOMEPAGE',
|
'url': 'https://www.gotostage.com/channel/bacc3d3535b34bafacc3f4ef8d4df78a/recording/831e74cd3e0042be96defba627b6f676/watch?source=HOMEPAGE',
|
||||||
@ -28,17 +33,15 @@ class GoToStageIE(InfoExtractor):
|
|||||||
'https://api.gotostage.com/contents?ids=%s' % video_id,
|
'https://api.gotostage.com/contents?ids=%s' % video_id,
|
||||||
video_id,
|
video_id,
|
||||||
note='Downloading video metadata',
|
note='Downloading video metadata',
|
||||||
errnote='Unable to download video metadata',
|
errnote='Unable to download video metadata')
|
||||||
)
|
|
||||||
|
|
||||||
registration_data = {
|
registration_data = {
|
||||||
'product': metadata[0].get('product'),
|
'product': try_get(metadata, lambda x: x[0]['product'], compat_str),
|
||||||
'resourceType': metadata[0].get('contentType'),
|
'resourceType': try_get(metadata, lambda x: x[0]['contentType'], compat_str),
|
||||||
'productReferenceKey': metadata[0].get('productRefKey'),
|
'productReferenceKey': try_get(metadata, lambda x: x[0]['productRefKey'], compat_str),
|
||||||
'firstName': 'foo',
|
'firstName': 'foo',
|
||||||
'lastName': 'bar',
|
'lastName': 'bar',
|
||||||
'email': 'foobar@example.com'
|
'email': 'foobar@example.com'}
|
||||||
}
|
|
||||||
|
|
||||||
registration_response = self._download_json(
|
registration_response = self._download_json(
|
||||||
'https://api-registrations.logmeininc.com/registrations',
|
'https://api-registrations.logmeininc.com/registrations',
|
||||||
@ -47,24 +50,21 @@ class GoToStageIE(InfoExtractor):
|
|||||||
expected_status=409,
|
expected_status=409,
|
||||||
headers={'Content-Type': 'application/json'},
|
headers={'Content-Type': 'application/json'},
|
||||||
note='Register user',
|
note='Register user',
|
||||||
errnote='Unable to register user',
|
errnote='Unable to register user')
|
||||||
)
|
|
||||||
|
|
||||||
content_response = self._download_json(
|
content_response = self._download_json(
|
||||||
'https://api.gotostage.com/contents/%s/asset' % video_id,
|
'https://api.gotostage.com/contents/%s/asset' % video_id,
|
||||||
video_id,
|
video_id,
|
||||||
headers={'x-registrantkey': registration_response.get('registrationKey')},
|
headers={'x-registrantkey': try_get(registration_response, lambda x: x['registrationKey'], compat_str)},
|
||||||
note='Get download url',
|
note='Get download url',
|
||||||
errnote='Unable to get download url',
|
errnote='Unable to get download url')
|
||||||
)
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'title': metadata[0].get('title'),
|
'title': try_get(metadata, lambda x: x[0]['title'], compat_str),
|
||||||
'url': content_response.get('cdnLocation'),
|
'url': try_get(content_response, lambda x: x['cdnLocation'], compat_str),
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'thumbnail': metadata[0].get('thumbnail').get('location'),
|
'thumbnail': url_or_none(try_get(metadata, lambda x: x[0]['thumbnail']['location'])),
|
||||||
'duration': metadata[0].get('duration'),
|
'duration': try_get(metadata, lambda x: x[0]['duration'], float),
|
||||||
'categories': [metadata[0].get('category')],
|
'categories': [try_get(metadata, lambda x: x[0]['category'], compat_str)],
|
||||||
'is_live': False
|
'is_live': False}
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user