101 lines
3.0 KiB
Python
Raw Normal View History

2025-03-30 16:04:34 +08:00
import hashlib
2025-03-30 22:49:37 +08:00
import random
2025-03-30 16:04:34 +08:00
from app.config.config import AppCtx
2025-03-30 16:04:34 +08:00
def md5(s: str) -> str:
m = hashlib.md5()
m.update(s.encode('utf-8'))
return m.hexdigest()
2025-03-30 22:49:37 +08:00
def get_proxies():
# username = "t14131310374591"
# password = "qg6xwmrq"
# tunnel = "d432.kdltps.com:15818"
# proxies = {
# "http": "http://%(user)s:%(pwd)s@%(proxy)s/" % {"user": username, "pwd": password, "proxy": tunnel},
# "https": "http://%(user)s:%(pwd)s@%(proxy)s/" % {"user": username, "pwd": password, "proxy": tunnel}
# }
2025-04-01 22:53:32 +08:00
# proxies = {
# "http": "http://127.0.0.1:8080",
# "https": "http://127.0.0.1:8080"
# }
proxy = AppCtx.g_app_config.chrome.proxy
proxies = {
"http": proxy,
"https": proxy
}
2025-03-30 22:49:37 +08:00
return proxies
def get_all_cookies():
cookies_holder = []
def inner():
if not cookies_holder:
for line in open('./data/live_cookies.txt', 'r'):
line = line.strip()
if line:
cookies_holder.append(line)
return cookies_holder
return inner()
def report_keywords():
return [
"成人", "av", "亚洲", "日韩", "欧美", "国产", "无码", "黄色", "丝袜", "少妇", "人妻"
]
def get_reporter_name():
surnames = [
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""
]
# 常用名字字
name_characters = [
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""
]
xing = random.choice(surnames)
ming = random.choice(name_characters)
ming2 = random.choice(name_characters)
if random.choice([True, False]):
return f"{xing}{ming}"
else:
return f"{xing}{ming}{ming2}"
def generate_random_phone_number():
"""
随机生成一个国内11位手机号
"""
# 常见的手机号段前3位移动、联通、电信等
prefixes = [
"134", "135", "136", "137", "138", "139", # 移动号段
"150", "151", "152", "157", "158", "159", # 移动号段
"130", "131", "132", "155", "156", # 联通号段
"133", "153", "180", "181", "189", # 电信号段
"177", "173", "175", # 其他号段
"199", "198", "166", # 新号段
"186", "187", "188", "139" # 常见号段
]
# 随机选择一个前缀
prefix = random.choice(prefixes)
# 随机生成剩余的8位数字
suffix = ''.join(random.choices("0123456789", k=8))
# 返回完整的手机号
return prefix + suffix