|
|
发表于
2020-5-4 12:16:02
来自手机
|
显示全部楼层
来自 广东
本帖最后由 老飞机 于 2020-5-13 15:09 编辑
家家骏 发表于 2020-5-4 12:14
没用
这个
- import requests , time , re , json
- session = requests.session()
- def sing_in():
- Sing_in_url = 'https://bbs.binmt.cc/member.php?mod=logging&action=login&loginsubmit=yes&loginhash=LtxLc&handlekey=loginform&inajax=1'
-
- headers ={
- 'Host': 'bbs.binmt.cc',
- 'User-Agent': 'Mozilla/5.0 (Linux; Android 10; MI 8 Build/QKQ1.190828.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/79.0.3945.93 Mobile Safari/537.36',
- }
- data={
- 'formhash':'93998e7d',
- 'referer':'https%3A%2F%2Fbbs.binmt.cc%2Fpage-1.html%3Fmobile%3D2',
- 'fastloginfield':'username',
- 'cookietime':'31104000',
- #'auth':'741egIVdsOFzrS2q9wRL68bA%2FwtNV4druNgT%2FcKbtnA37xF2oLZJDUXqHxgJm%2FxbIoWuLEOGOtu%2BuUo',
- 'username':'%E8%80%81%E9%A3%9E%E6%9C%BA',
- 'password':'zxcvbnm',
- 'questionid':'0',
- 'answer':'',
- 'seccodehash':'SGM9Q',
- 'seccodeverify':'772b',
- }
- cookiet = '{"cookie": ""}'
- cookies_dict = json.loads(cookiet)
- cookies = requests.utils.cookiejar_from_dict(cookies_dict)
- session.cookies = cookies
- response = session.post(Sing_in_url,headers=headers,data=data).text
- print(response)
- print('登录成功\n\n\n\n')
- def data_html():
- url = 'https://bbs.binmt.cc/k_misign-sign.html'
- headers = {'User-Agent': 'Mozilla/5.0 (Linux; Android 10; MI 8 Build/QKQ1.190828.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/79.0.3945.93 Mobile Safari/537.36',}
- response = session.get(url,headers=headers).text
- data = re.findall('htmlobj(.*?)async:false,contentType',str(response))
- sing_in_url = re.findall("url:(.*?),'",str(data))[1:2]
- time_img(sing_in_url)
- def time_img(login_url):
- while True:
- time_now = time.strftime("%H:%M:%S", time.localtime()) # 刷新当前时间
- subject = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()) + " 定时发送测试"
- print(time_now)
- if time_now >= "00:00:00": #此处设置每天定时的时间
- current_time = time.time()
- index_url = 'https://bbs.binmt.cc/' + str(login_url)[3:-3]
- headers = {
- 'Host': 'bbs.binmt.cc',
- 'User-Agent': 'Mozilla/5.0 (Linux; Android 10; MI 8 Build/QKQ1.190828.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/79.0.3945.93 Mobile Safari/537.36',
- 'Referer': 'https://bbs.binmt.cc/k_misign-sign.html',
- }
- cookie = {
- 'cookie': ''
- }
- response = session.get(index_url , headers = headers).text
-
- respoe = session.get(index_url , headers = headers).text
- end_time = time.time()-current_time
- end_time = str(end_time)[0:6]
- if "<?xml" in response:
- print(response,"\n\n本次签到已用时间:",end_time)
-
- print(subject)
- sing_ins_url = "https://bbs.binmt.cc/k_misign-sign.html"
- resopn = session.get(sing_ins_url , headers = headers).text
-
- re_data = re.findall("今日排名</span>(.*?)</li>",resopn)
-
- print('今日排名:',re_data)
- break
- if __name__=='__main__':
- sing_in()
- data_html()
复制代码 |
|