Skip to content

Commit

Permalink
fix: 兼容windows编码问题
Browse files Browse the repository at this point in the history
  • Loading branch information
NanmiCoder committed Oct 28, 2024
1 parent 9bf6ea3 commit ef4eba1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion media_platform/douyin/help.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
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():
"""
Expand Down
2 changes: 1 addition & 1 deletion media_platform/zhihu/help.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit ef4eba1

Please sign in to comment.