fix: 兼容windows编码问题
This commit is contained in:
parent
9bf6ea3650
commit
ef4eba121c
|
@ -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():
|
||||
"""
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue