获取到网站信息并分析
import requests,re
from requests.auth import HTTPBasicAuth
from lxml import etree
EnterInput = input("""pealse select
---------------------
|1.goodworkers |
---------------------
|2.goodworkers4 |
---------------------
|3.wrongworkers |
---------------------
|4.offlineworkers |
---------------------
|5.delOfflineWorker |
---------------------
|6.delOfflineWorker |
---------------------
|7.unknowworkers |
---------------------
请输入:""")
def GetHtmlIp(COUNT):
count = int(COUNT)
auth = HTTPBasicAuth("yzq".encode('utf-8'), "8888888")
resopnse = requests.get("网址", auth=auth)
html = etree.HTML(resopnse.text)
name = html.xpath('//div[@class="box"]/dl[{}]/dd/li'.format(int(count)))
for i in name:
if count == 2:
print(str(i.text).split(",")[0])
if count == 4:
if str(i.text).split(" ")[0].split("-")[0]:
ErrorOut = str(i.text).split(" ")
if 'no' in ErrorOut and 'host':
print(ErrorOut[0])
elif str(i.text).split(" ")[0].split("-")[0]:
print(str(i.text).split(" ")[0].split("-")[1])
if __name__ == '__main__':
GetHtmlIp(EnterInput)
获取到网站信息并筛选自己想要的信息
import requests,json
import time
messlist = {}
net = {'AccountInfo': {
'111': '111',
'1112': '1113',
}}
ples = {
'111': '111',
'1121': '1112',
}
def AccountManagement():
for i,j in net['AccountInfo'].items():
t023200 = 'https://filfox.info/api/v0/address/{}/messages?pageSize=1&page=0'.format(i)
res = requests.get(t023200)
t023200_balance = 'https://filfox.info/api/v0/address/{}/balance-stats?duration=24h&samples=1'.format(j)
res1 = requests.get(t023200_balance)
messlist[i] = res.text
messlist[j] = res1.text
return messlist
def info(jy):
url = 'https://oapi.dingtalk.com/robot/send?access_token=59eeb069d68957c6c09f1d169fa908b77470481751d3634fa25ecf06e12831bb'
headers = {
'Content-Type': 'application/json;charset=utf-8'
}
formdata = {
"msgtype": "text",
"text": {"content": str(jy)}
}
requests.post(url=url, data=json.dumps(formdata), headers=headers)
def get_messages(count):
for accountkey,accountvalue in count.items():
if len(accountkey) < 10:
accountvalue=eval(accountvalue)['messages']
for i in accountvalue:
timestamp= i['timestamp']
account_number=i['to']
if timestamp:
now = time.time() - timestamp
Datetime = time.gmtime(now)
if int(Datetime.tm_min) >= 4:
data = "账号:{}相差{}时{}分无消息.".format(account_number,Datetime.tm_hour,Datetime.tm_min)
info(data)
else:
pass
def GetBalance(Bla):
for accountkey, accountvalue in Bla.items():
if len(accountkey) > 10:
Bla = eval(accountvalue)
Balance = round(int(Bla[0]['balance']) / 1000000000000000000)
if Balance < 100:
if accountkey == '111':
print(accountkey)
data = "XXX:{}\r不足100:\r还剩余{}.".format(accountkey,Balance)
info(data)
if accountkey == '1112':
print(accountkey)
data = "XXX:{}\r不足100:\r还剩余{}.".format(accountkey,Balance)
info(data)
if __name__ == '__main__':
get_messages(AccountManagement())
GetBalance(AccountManagement())