From 952eeb9b7cec2e69dfe7d632c98bca5316f3b425 Mon Sep 17 00:00:00 2001 From: ihmily <114978440+ihmily@users.noreply.github.com> Date: Mon, 30 Jun 2025 21:53:23 +0800 Subject: [PATCH] fix: handle twitch live record ad issues --- src/spider.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/spider.py b/src/spider.py index 67c0842..6eb180c 100644 --- a/src/spider.py +++ b/src/spider.py @@ -23,7 +23,7 @@ import json import execjs import urllib.request from . import JS_SCRIPT_PATH, utils -from .utils import trace_error_decorator +from .utils import trace_error_decorator, generate_random_string from .logger import script_path from .room import get_sec_user_id, get_unique_id, UnsupportedUrlError from .http_clients.async_http import async_req @@ -1970,6 +1970,7 @@ async def get_twitchtv_stream_data(url: str, proxy_addr: OptionalStr = None, coo 'Accept-Language': 'en-US', 'Referer': 'https://www.twitch.tv/', 'Client-ID': 'kimne78kx3ncx6brgo4mv6wki5h1ko', + 'device-id': generate_random_string(16).lower(), } if cookies: @@ -3015,4 +3016,4 @@ async def get_faceit_stream_data(url: str, proxy_addr: OptionalStr = None, cooki result['anchor_name'] = anchor_name else: result = {'anchor_name': anchor_name, 'is_live': False} - return result + return result \ No newline at end of file