From ef4eba121c3797062bf07cb38ec3c84d6412c856 Mon Sep 17 00:00:00 2001 From: Relakkes Date: Mon, 28 Oct 2024 15:26:49 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=85=BC=E5=AE=B9windows=E7=BC=96?= =?UTF-8?q?=E7=A0=81=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- media_platform/douyin/help.py | 2 +- media_platform/zhihu/help.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/media_platform/douyin/help.py b/media_platform/douyin/help.py index 7034846..1ed3111 100644 --- a/media_platform/douyin/help.py +++ b/media_platform/douyin/help.py @@ -20,7 +20,7 @@ import random import execjs from playwright.async_api import Page -douyin_sign_obj = execjs.compile(open('libs/douyin.js', encoding='utf-8').read()) +douyin_sign_obj = execjs.compile(open('libs/douyin.js', encoding='utf-8-sig').read()) def get_web_id(): """ diff --git a/media_platform/zhihu/help.py b/media_platform/zhihu/help.py index 7a62c4b..83dccd1 100644 --- a/media_platform/zhihu/help.py +++ b/media_platform/zhihu/help.py @@ -36,7 +36,7 @@ def sign(url: str, cookies: str) -> Dict: """ global ZHIHU_SGIN_JS if not ZHIHU_SGIN_JS: - with open("libs/zhihu.js", "r") as f: + with open("libs/zhihu.js", mode="r", encoding="utf-8-sig") as f: ZHIHU_SGIN_JS = execjs.compile(f.read()) return ZHIHU_SGIN_JS.call("get_sign", url, cookies)