fix: 兼容windows编码问题

This commit is contained in:
Relakkes 2024-10-28 15:26:49 +08:00
parent 9bf6ea3650
commit ef4eba121c
2 changed files with 2 additions and 2 deletions

View File

@ -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():
"""

View File

@ -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)