diff --git a/browser_gateway/platform/douyin.py b/browser_gateway/platform/douyin.py index 64b2a05..537d428 100644 --- a/browser_gateway/platform/douyin.py +++ b/browser_gateway/platform/douyin.py @@ -1547,7 +1547,9 @@ def fetch_douyin_image(self: object, alias: str, target: str) -> BrowserMediaRes result = cdp.evaluate( f"""(async()=>{{ try {{ - const r=await fetch({json.dumps(target)},{{credentials:'include',redirect:'error'}}); + // douyinpic CDN 返回 Access-Control-Allow-Origin:'*',跨站 fetch 不能带凭据, + // credentials:'include' 会直接 TypeError Failed to fetch;公共图片无需 cookies。 + const r=await fetch({json.dumps(target)},{{credentials:'omit',redirect:'error'}}); if(!r.body)return {{status:r.status,content_type:r.headers.get('content-type')||'',body:'',too_large:false}}; const reader=r.body.getReader(), chunks=[]; let size=0; for(;;){{const item=await reader.read();if(item.done)break;