rgfewfger
This commit is contained in:
@@ -216,7 +216,7 @@ class Hub_Web:
|
||||
content = f.read()
|
||||
|
||||
tasks = [] # 创建任务列表
|
||||
lines = content.split('\n\n')
|
||||
lines = content.split('\n')
|
||||
print(lines)
|
||||
|
||||
# 随机选择一个段落
|
||||
|
||||
49
推特/test.py
49
推特/test.py
@@ -1,43 +1,12 @@
|
||||
from urllib.parse import urlparse
|
||||
import random
|
||||
|
||||
from bit_tools import deleteBrowser
|
||||
from models import ips
|
||||
from models.ips import Ips
|
||||
from models.xstart import Xstart
|
||||
with open('推文.txt', 'r', encoding='utf-8') as f:
|
||||
content = f.read()
|
||||
|
||||
if __name__ == '__main__':
|
||||
tasks = [] # 创建任务列表
|
||||
lines = content.split('\n')
|
||||
print(lines)
|
||||
|
||||
# 打开 ip.txt 文件,以只读模式和 UTF-8 编码读取文件内容
|
||||
with open('ip.txt', 'r', encoding='utf-8') as f:
|
||||
content = f.read()
|
||||
|
||||
# 将文件内容按换行符分割成多行,存储在 lines 列表中
|
||||
lines = content.split('\n')
|
||||
|
||||
# 遍历 lines 列表中的每一行
|
||||
for line in lines:
|
||||
if line: # 跳过空行
|
||||
# 手动解析代理信息
|
||||
scheme, rest = line.split('://', 1)
|
||||
host_port_user_pass = rest.split(':', 3)
|
||||
host = host_port_user_pass[0]
|
||||
port = int(host_port_user_pass[1])
|
||||
username = host_port_user_pass[2]
|
||||
password = host_port_user_pass[3]
|
||||
|
||||
# 尝试从数据库中查找或创建一个新的代理记录
|
||||
Ips.get_or_create(
|
||||
host=host,
|
||||
port=port,
|
||||
username=username,
|
||||
password=password,
|
||||
)
|
||||
|
||||
# for i in Xstart.select().where(
|
||||
# Xstart.start == "0"
|
||||
# ):
|
||||
# print(i.x_id)
|
||||
#
|
||||
# deleteBrowser(id=i.bit_id)
|
||||
#
|
||||
# i.delete_instance()
|
||||
# 随机选择一个段落
|
||||
random_paragraph = random.choice(lines)
|
||||
print(random_paragraph)
|
||||
|
||||
Reference in New Issue
Block a user