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)