feat: add support for video livestreams
This commit is contained in:
@@ -437,10 +437,16 @@ def videos(data):
|
||||
|
||||
format_streams = []
|
||||
# adaptive_formats, format_streams = rebuildFormats(adaptive_formats)
|
||||
adaptive_formats, format_streams = rebuildFormatsFromYtdlpApi(ydata)
|
||||
if not live_now:
|
||||
adaptive_formats, format_streams = rebuildFormatsFromYtdlpApi(ydata)
|
||||
hls_url = None
|
||||
else:
|
||||
adaptive_formats, format_streams = [{"url": f"http://a/?expire={int(time_start + 5.9 * 60 * 60)}", "itag": "18", "type": "", "clen": "0", "lmt": "", "projectionType": "RECTANGULAR"}], [] # freetube/clipious shenanigans, see: https://github.com/FreeTubeApp/FreeTube/pull/5997 and https://github.com/lamarios/clipious/blob/b9e7885/lib/videos/models/adaptive_format.g.dart
|
||||
hls_url = safeTraverse(ydata, ["url"], default="ythdd: unable to retrieve stream url")
|
||||
|
||||
if live_now:
|
||||
video_type = "livestream"
|
||||
video_type = "livestream"
|
||||
premiere_timestamp = published # ??? that works i guess
|
||||
elif premiere_timestamp:
|
||||
video_type = "scheduled"
|
||||
published = dateToEpoch(premiere_timestamp) if premiere_timestamp else int(time())
|
||||
@@ -496,7 +502,7 @@ def videos(data):
|
||||
"isUpcoming": is_upcoming,
|
||||
"dashUrl": ythdd_globals.config['general']['public_facing_url'] + "api/invidious/api/v1/manifest/" + video_id, # not implemented
|
||||
"premiereTimestamp": premiere_timestamp,
|
||||
#"hlsUrl": hls_url, # broken after a change in iOS player, only usable for livestreams
|
||||
"hlsUrl": hls_url, # broken after a change in iOS player, only usable for livestreams
|
||||
"adaptiveFormats": adaptive_formats, # same as hlsUrl
|
||||
"formatStreams": format_streams,
|
||||
"captions": [], # not implemented
|
||||
|
||||
Reference in New Issue
Block a user