fwefwf
This commit is contained in:
91
bit_tools.py
91
bit_tools.py
@@ -1,9 +1,12 @@
|
||||
import json
|
||||
import random
|
||||
|
||||
import requests
|
||||
from peewee import fn
|
||||
|
||||
from models.ips import Ips
|
||||
from models.xstart import Xstart
|
||||
from models.xtoken import XToken
|
||||
|
||||
url = "http://127.0.0.1:54345"
|
||||
headers = {'Content-Type': 'application/json'}
|
||||
@@ -90,13 +93,17 @@ def query_bit_browser(page, page_size):
|
||||
|
||||
def update_proxy_Browser(
|
||||
id,
|
||||
host, port, proxyUserName, proxyPassword
|
||||
host,
|
||||
port,
|
||||
proxyType="socks5",
|
||||
proxyUserName="",
|
||||
proxyPassword=""
|
||||
):
|
||||
json_data = {
|
||||
"ids": [id],
|
||||
# "ipCheckService": "ip123in",
|
||||
"proxyMethod": 2,
|
||||
"proxyType": "socks5",
|
||||
"proxyType": proxyType,
|
||||
"host": host,
|
||||
"port": port,
|
||||
"proxyUserName": proxyUserName,
|
||||
@@ -104,6 +111,7 @@ def update_proxy_Browser(
|
||||
}
|
||||
|
||||
res = requests.post(f'{url}/browser/proxy/update', data=json.dumps(json_data), headers=headers)
|
||||
print(res.json())
|
||||
return res.json()
|
||||
|
||||
|
||||
@@ -169,6 +177,22 @@ def browser_detail(id):
|
||||
return res.json()
|
||||
|
||||
|
||||
def group_update(groupId, browserIds):
|
||||
# json_data = {
|
||||
# "groupId": "41notc1202sr8gu5o6emb9ihaqbzbkic",
|
||||
# "browserIds": ["af25e626167f4870b8f257e697bb4f05", "3baa6e990fee4e839c72722c8dc18019"]
|
||||
# }
|
||||
|
||||
json_data = {
|
||||
"groupId": groupId,
|
||||
"browserIds": browserIds
|
||||
}
|
||||
|
||||
res = requests.post(f'{url}/browser/group/update', data=json.dumps(json_data), headers=headers)
|
||||
|
||||
return res.json()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
# for i in Xstart.select().where(
|
||||
# Xstart.x_id.is_null()
|
||||
@@ -183,28 +207,28 @@ if __name__ == '__main__':
|
||||
# proxyPassword=ips_info.password
|
||||
# )
|
||||
|
||||
fz_datas = get_group_lists()
|
||||
# fz_datas['推特']
|
||||
|
||||
for i in range(10):
|
||||
for i in get_browser_lists_Browser(id=fz_datas['推特'], page=i):
|
||||
x_start_info = Xstart.get_or_none(
|
||||
Xstart.bit_id == i["id"]
|
||||
)
|
||||
|
||||
if not x_start_info:
|
||||
deleteBrowser(id=i["id"])
|
||||
|
||||
continue
|
||||
|
||||
if x_start_info.start:
|
||||
continue
|
||||
|
||||
deleteBrowser(id=i["id"])
|
||||
|
||||
# x_start_info.delete_instance()
|
||||
x_start_info.bit_id = None
|
||||
x_start_info.save()
|
||||
# fz_datas = get_group_lists()
|
||||
# # fz_datas['推特']
|
||||
#
|
||||
# for i in range(10):
|
||||
# for i in get_browser_lists_Browser(id=fz_datas['推特'], page=i):
|
||||
# x_start_info = Xstart.get_or_none(
|
||||
# Xstart.bit_id == i["id"]
|
||||
# )
|
||||
#
|
||||
# if not x_start_info:
|
||||
# deleteBrowser(id=i["id"])
|
||||
#
|
||||
# continue
|
||||
#
|
||||
# if x_start_info.start:
|
||||
# continue
|
||||
#
|
||||
# deleteBrowser(id=i["id"])
|
||||
#
|
||||
# # x_start_info.delete_instance()
|
||||
# x_start_info.bit_id = None
|
||||
# x_start_info.save()
|
||||
|
||||
# for i in Xstart.select():
|
||||
# res = browser_detail(id=i.bit_id)
|
||||
@@ -215,3 +239,22 @@ if __name__ == '__main__':
|
||||
# i.save()
|
||||
|
||||
# print(browser_detail(id="532651f5330e4caa917e644f9b676b"))
|
||||
|
||||
# 批量修改代理
|
||||
for i in Xstart.select():
|
||||
update_proxy_Browser(id=i.bit_id, proxyType="http", host="104.168.59.92", port=random.randint(20001, 25000), )
|
||||
|
||||
# fz_datas = get_group_lists()
|
||||
# print(fz_datas)
|
||||
# bit_id_list = []
|
||||
# for i in XToken.select().where(XToken.start.is_null(False)):
|
||||
# sql_info = Xstart.get_or_none(
|
||||
# Xstart.x_id == i.id
|
||||
# )
|
||||
#
|
||||
# bit_id_list.append(sql_info.bit_id)
|
||||
#
|
||||
# print(len(bit_id_list))
|
||||
# print(bit_id_list)
|
||||
#
|
||||
# print(group_update(fz_datas["英语"], bit_id_list))
|
||||
|
||||
Reference in New Issue
Block a user