From 2d6550ea69beb4db490c0d7b1b97bf861886a037 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michele=20Zuccal=C3=A0?= Date: Sat, 13 Jan 2024 15:19:33 +0100 Subject: [PATCH] platformtools: fix user agent for hls playlist and hls key (#454) --- platformcode/platformtools.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/platformcode/platformtools.py b/platformcode/platformtools.py index bbb637af..c5720e06 100644 --- a/platformcode/platformtools.py +++ b/platformcode/platformtools.py @@ -1126,14 +1126,15 @@ def play_video(item, strm=False, force_direct=False, autoplay=False): xlistitem.setProperty("inputstream.adaptive.license_type", item.drm) xlistitem.setProperty("inputstream.adaptive.license_key", item.license) xlistitem.setMimeType('application/dash+xml') - xlistitem.setProperty('inputstream.adaptive.stream_headers', httptools.get_user_agent()) + xlistitem.setProperty('inputstream.adaptive.stream_headers', 'User-Agent='+httptools.get_user_agent()) elif hls or item.manifest == 'hls':# or (mediaurl.split('|')[0].endswith('m3u8') and mediaurl.startswith('http')): if not install_inputstream(): return xlistitem.setProperty('inputstream' if PY3 else 'inputstreamaddon', 'inputstream.adaptive') xlistitem.setProperty('inputstream.adaptive.manifest_type', 'hls') xlistitem.setMimeType('application/x-mpegURL') - xlistitem.setProperty('inputstream.adaptive.stream_headers', httptools.get_user_agent()) + xlistitem.setProperty('inputstream.adaptive.stream_headers', 'User-Agent='+httptools.get_user_agent()) + xlistitem.setProperty('inputstream.adaptive.license_key', '|User-Agent='+httptools.get_user_agent() +'|') if force_direct: item.play_from = 'window'