1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2025-08-18 02:18:29 +00:00

refactor: return both hls and llhls streams

This commit is contained in:
JChris246 2025-03-17 23:09:45 -04:00
parent 57c5540f5a
commit c3f86881df

View File

@ -96,14 +96,18 @@ def webpage_extraction(self, video_id):
params = self.get_required_params(webpage)
if not params.get('sid'):
raise UserNotLive('Model offline')
formats = self._extract_m3u8_formats(
'https://edgevideo.myfreecams.com/llhls/NxServer/' + params['sid'] + '/ngrp:mfc_' + params['a'] + params['mid'] + '.f4v_mobile/playlist.m3u8',
video_id, ext='mp4', m3u8_id='llhls', live=True)
formats.extend(self._extract_m3u8_formats('https://edgevideo.myfreecams.com/hls/NxServer/' + params['sid'] + '/ngrp:mfc_' + params['a'] + params['mid'] + '.f4v_mobile/playlist.m3u8',
video_id, ext='mp4', m3u8_id='hls', live=True))
return {
'id': video_id,
'title': video_id,
'is_live': True,
'formats': self._extract_m3u8_formats(
'https://edgevideo.myfreecams.com/hls/NxServer/' + params['sid'] + '/ngrp:mfc_' + params['a'] + params['mid'] + '.f4v_mobile/playlist.m3u8',
video_id, 'mp4', live=True),
'formats': formats,
'age_limit': 18,
'thumbnail': self._search_regex(r'(https?://img\.mfcimg\.com/photos2?/\d+/\d+/avatar\.\d+x\d+.jpg(?:\?nc=\d+)?)', webpage, 'thumbnail', fatal=False),
}
@ -160,7 +164,10 @@ def _real_extract(self, url):
formats = self._extract_m3u8_formats(
f'https://edgevideo.myfreecams.com/llhls/NxServer/{server_id}/ngrp:mfc_{phase}{mid}.f4v_cmaf/playlist_sfm4s.m3u8?nc={rand_val}&v=1.97.23',
video_id, 'mp4', live=True)
video_id, ext='mp4', m3u8_id='llhls', live=True)
formats.extend(self._extract_m3u8_formats(
f'https://edgevideo.myfreecams.com/hls/NxServer/{server_id}/ngrp:mfc_{phase}{mid}.f4v_cmaf/playlist_sfm4s.m3u8?nc={rand_val}&v=1.97.23',
video_id, ext='mp4', m3u8_id='hls', live=True))
if not formats or len(formats) < 1:
self.report_warning('Unable to stream urls from api, falling back to webpage extraction')