Compare commits

...

7 Commits

Author SHA1 Message Date
MyNey
d2f6d72652
Merge fb127cccd2 into 4b5eec0aaa 2024-11-25 20:59:56 +05:30
Jakob Kruse
4b5eec0aaa
[ie/chaturbate] Fix support for non-public streams (#11624)
Fix bug in 720b3dc453

Closes #11623
Authored by: jkruse
2024-11-24 22:20:30 +00:00
MinePlayersPE
fb127cccd2
Merge branch 'yt-dlp:master' into vidio-live 2021-12-29 13:55:11 +07:00
MinePlayersPE
50306a11eb linter 2021-08-24 09:19:32 +07:00
MinePlayersPE
deab7eb786 Update vidio.py 2021-08-24 09:18:27 +07:00
MinePlayersPE
a70f889927
Merge branch 'yt-dlp:master' into vidio-live 2021-08-24 07:54:05 +07:00
MinePlayersPE
a746212d7b Add live dash support 2021-08-24 07:42:22 +07:00
2 changed files with 27 additions and 11 deletions

View File

@ -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:
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.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,

View File

@ -1,4 +1,5 @@
from .common import InfoExtractor from .common import InfoExtractor
from ..compat import compat_urllib_parse_urlparse
from ..utils import ( from ..utils import (
ExtractorError, ExtractorError,
clean_html, clean_html,
@ -276,8 +277,16 @@ class VidioLiveIE(VidioBaseIE):
display_id, note='Downloading HLS token JSON', data=b'') display_id, note='Downloading HLS token JSON', data=b'')
formats.extend(self._extract_m3u8_formats( formats.extend(self._extract_m3u8_formats(
sources['source'] + '?' + token_json.get('token', ''), display_id, 'mp4', 'm3u8_native')) sources['source'] + '?' + token_json.get('token', ''), display_id, 'mp4', 'm3u8_native'))
if str_or_none(sources.get('source_dash')): if str_or_none(sources.get('source_dash')): # TODO: Find live example with source_dash
pass parsed_base_dash = compat_urllib_parse_urlparse(sources['source_dash'])
token_json = self._download_json(
'https://www.vidio.com/live/%s/tokens?type=dash' % video_id,
display_id, note='Downloading DASH token JSON', data=b'')
parsed_tokenized_dash = parsed_base_dash._replace(path=token_json.get('token', '')
+ (parsed_base_dash.path if parsed_base_dash.path[0] == '/'
else '/' + parsed_base_dash.path))
formats.extend(self._extract_mpd_formats(
parsed_tokenized_dash.geturl(), display_id, 'dash'))
else: else:
if stream_meta.get('stream_token_url'): if stream_meta.get('stream_token_url'):
token_json = self._download_json( token_json = self._download_json(
@ -287,7 +296,15 @@ class VidioLiveIE(VidioBaseIE):
stream_meta['stream_token_url'] + '?' + token_json.get('token', ''), stream_meta['stream_token_url'] + '?' + token_json.get('token', ''),
display_id, 'mp4', 'm3u8_native')) display_id, 'mp4', 'm3u8_native'))
if stream_meta.get('stream_dash_url'): if stream_meta.get('stream_dash_url'):
pass parsed_base_dash = compat_urllib_parse_urlparse(stream_meta['stream_dash_url'])
token_json = self._download_json(
'https://www.vidio.com/live/%s/tokens?type=dash' % video_id,
display_id, note='Downloading DASH token JSON', data=b'')
parsed_tokenized_dash = parsed_base_dash._replace(path=token_json.get('token', '')
+ (parsed_base_dash.path if parsed_base_dash.path[0] == '/'
else '/' + parsed_base_dash.path))
formats.extend(self._extract_mpd_formats(
parsed_tokenized_dash.geturl(), display_id, 'dash'))
if stream_meta.get('stream_url'): if stream_meta.get('stream_url'):
formats.extend(self._extract_m3u8_formats( formats.extend(self._extract_m3u8_formats(
stream_meta['stream_url'], display_id, 'mp4', 'm3u8_native')) stream_meta['stream_url'], display_id, 'mp4', 'm3u8_native'))