自用策略初始提交

This commit is contained in:
cls
2025-11-06 10:26:02 +08:00
commit 8a7583f111
90 changed files with 1053065 additions and 0 deletions
+31
View File
@@ -0,0 +1,31 @@
# coding:utf-8
import json
def parse_cookies_str(cookies):
"""
parse cookies str to dict
:param cookies: cookies str
:type cookies: str
:return: cookie dict
:rtype: dict
"""
cookie_dict = {}
for record in cookies.split(";"):
key, value = record.strip().split("=", 1)
cookie_dict[key] = value
return cookie_dict
def file2dict(path):
with open(path, encoding="utf-8") as f:
return json.load(f)
def grep_comma(num_str):
return num_str.replace(",", "")
def str2num(num_str, convert_type="float"):
num = float(grep_comma(num_str))
return num if convert_type == "float" else int(num)