Compare commits

...

4 Commits

Author SHA1 Message Date
Abdulmohsen
c0a8da5418
Merge d3aec35e5b into 4b5eec0aaa 2024-11-25 08:30:42 +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
ArabCoders
d3aec35e5b implemented requested changes 2024-03-16 22:16:11 +03:00
ArabCoders
395d2793aa Added method to download using already extracted info 2024-03-16 18:36:13 +03:00
2 changed files with 20 additions and 15 deletions

View File

@ -3607,13 +3607,10 @@ def download(self, url_list):
return self._download_retcode
def download_with_info_file(self, info_filename):
with contextlib.closing(fileinput.FileInput(
[info_filename], mode='r',
openhook=fileinput.hook_encoded('utf-8'))) as f:
# FileInput doesn't have a read method, we can't call json.load
infos = [self.sanitize_info(info, self.params.get('clean_infojson', True))
for info in variadic(json.loads('\n'.join(f)))]
def download_with_info(self, *info_list):
"""Download using already extracted info_dicts."""
infos = [self.sanitize_info(info, self.params.get('clean_infojson', True))
for info in info_list]
for info in infos:
try:
self.__download_wrapper(self.process_ie_result)(info, download=True)
@ -3629,6 +3626,15 @@ def download_with_info_file(self, info_filename):
self.report_error(e)
return self._download_retcode
def download_with_info_file(self, info_filename):
"""Download using an info file."""
with contextlib.closing(fileinput.FileInput(
[info_filename], mode='r',
openhook=fileinput.hook_encoded('utf-8'))) as f:
# FileInput doesn't have a read method, we can't call json.load
infos = [info for info in variadic(json.loads('\n'.join(f)))]
return self.download_with_info(infos)
@staticmethod
def sanitize_info(info_dict, remove_private_keys=False):
""" Sanitize the infodict for converting to json """

View File

@ -59,16 +59,15 @@ def _extract_from_api(self, video_id, tld):
'Accept': 'application/json',
}, 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')
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 {
'id': video_id,