mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-27 01:31:25 +01:00
Compare commits
3 Commits
8e7348564d
...
7bd83af77e
Author | SHA1 | Date | |
---|---|---|---|
|
7bd83af77e | ||
|
4b5eec0aaa | ||
|
ed4d9a40c1 |
|
@ -59,16 +59,15 @@ class ChaturbateIE(InfoExtractor):
|
||||||
'Accept': 'application/json',
|
'Accept': 'application/json',
|
||||||
}, fatal=False, impersonate=True) or {}
|
}, fatal=False, impersonate=True) or {}
|
||||||
|
|
||||||
status = response.get('room_status')
|
|
||||||
if status != 'public':
|
|
||||||
if error := self._ERROR_MAP.get(status):
|
|
||||||
raise ExtractorError(error, expected=True)
|
|
||||||
self.report_warning('Falling back to webpage extraction')
|
|
||||||
return None
|
|
||||||
|
|
||||||
m3u8_url = response.get('url')
|
m3u8_url = response.get('url')
|
||||||
if not m3u8_url:
|
if not m3u8_url:
|
||||||
self.raise_geo_restricted()
|
status = response.get('room_status')
|
||||||
|
if error := self._ERROR_MAP.get(status):
|
||||||
|
raise ExtractorError(error, expected=True)
|
||||||
|
if status == 'public':
|
||||||
|
self.raise_geo_restricted()
|
||||||
|
self.report_warning(f'Got status "{status}" from API; falling back to webpage extraction')
|
||||||
|
return None
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
|
|
|
@ -5,6 +5,7 @@ import urllib.parse
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
ExtractorError,
|
ExtractorError,
|
||||||
|
determine_ext,
|
||||||
float_or_none,
|
float_or_none,
|
||||||
mimetype2ext,
|
mimetype2ext,
|
||||||
smuggle_url,
|
smuggle_url,
|
||||||
|
@ -268,7 +269,29 @@ class MediasiteIE(InfoExtractor):
|
||||||
formats.extend(stream_formats)
|
formats.extend(stream_formats)
|
||||||
|
|
||||||
# XXX: Presentation['Presenters']
|
# XXX: Presentation['Presenters']
|
||||||
# XXX: Presentation['Transcript']
|
transcripts = presentation.get('Transcripts', {})
|
||||||
|
captions, subtitles = {}, {}
|
||||||
|
for transcript in transcripts:
|
||||||
|
lang_code = traverse_obj(
|
||||||
|
transcript, (('DetailedLanguageCode', 'LanguageCode'), {str}), get_all=False)
|
||||||
|
lang_name = transcript.get('Language')
|
||||||
|
t = {
|
||||||
|
'url': transcript.get('CaptionsUrl'),
|
||||||
|
'name': lang_name,
|
||||||
|
}
|
||||||
|
if 'Auto-Generated' in lang_name:
|
||||||
|
captions.setdefault(lang_code, []).append(t)
|
||||||
|
else:
|
||||||
|
subtitles.setdefault(lang_code, []).append(t)
|
||||||
|
if transcript_url := presentation.get('TranscriptUrl'):
|
||||||
|
if determine_ext(transcript_url) != 'txt':
|
||||||
|
if len(transcripts) == 1 and captions:
|
||||||
|
captions.setdefault(lang_code, []).append({
|
||||||
|
'url': transcript_url,
|
||||||
|
'name': lang_name,
|
||||||
|
})
|
||||||
|
else:
|
||||||
|
subtitles.setdefault('und', []).append({'url': transcript_url})
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': resource_id,
|
'id': resource_id,
|
||||||
|
@ -277,6 +300,8 @@ class MediasiteIE(InfoExtractor):
|
||||||
'duration': float_or_none(presentation.get('Duration'), 1000),
|
'duration': float_or_none(presentation.get('Duration'), 1000),
|
||||||
'timestamp': float_or_none(presentation.get('UnixTime'), 1000),
|
'timestamp': float_or_none(presentation.get('UnixTime'), 1000),
|
||||||
'formats': formats,
|
'formats': formats,
|
||||||
|
'automatic_captions': captions,
|
||||||
|
'subtitles': subtitles,
|
||||||
'thumbnails': thumbnails,
|
'thumbnails': thumbnails,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user