TLYPython签到

查看 44|回复 2
作者:丶七年   
[Python] 纯文本查看 复制代码import time
import requests
import base64
import json
from datetime import datetime
cookie="" 账号ck
token='' #验证码token
#http://www.bhshare.cn/imgcode/ 这里申请token
def imgcode_online(imgurl):
    data = {
   
        'token': token,
        'type': 'online',
        'uri': imgurl
    }
    response = requests.post('http://www.bhshare.cn/imgcode/', data=data)
    print(response.text)
    result = json.loads(response.text)
    if result['code'] == 200:
        print(result['data'])
        return result['data']
    else:
        print(result['msg'])
        return 'error'
def getmidstring(html, start_str, end):
    start = html.find(start_str)
    if start >= 0:
        start += len(start_str)
        end = html.find(end, start)
        if end >= 0:
            return html[start:end].strip()
def tly():
    signUrl="https://tly30.com/modules/index.php"
    hearder={'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36','Cookie':cookie}
    res=requests.get(url=signUrl,headers=hearder).text
    signtime=getmidstring(res,'上次签到时间:','
')
    timeArray = time.strptime(signtime, "%Y-%m-%d %H:%M:%S")
    timeStamp = int(time.mktime(timeArray))
    t = int(time.time())
    if t-timeStamp>86400:
        print("距上次签到时间大于24小时啦,可签到")
        #获取验证码图片
        captchaUrl="https://tly30.com/other/captcha.php"
        signurl="https://tly30.com/modules/_checkin.php?captcha="
        hearder={'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36','Cookie':cookie}
        res1=requests.get(url=captchaUrl,headers=hearder)
        base64_data = base64.b64encode(res1.content)
        oocr=imgcode_online('data:image/jpeg;base64,'+str(base64_data, 'utf-8'))
        res2=requests.get(url=signurl+oocr.upper(),headers=hearder).text
        print(res2)
    else:
        print("还未到时间!",t-timeStamp)
   

def main_handler(event, context):
    tly()
if __name__ == '__main__':
    tly()
Python TLY签到,可以挂云函数设置1小时、2小时进行签到,反正做了24小时是否到期验证

小时, 时间

apull   

刚试了下,好使。
xixicoco   

云函数比较好啊
您需要登录后才可以回帖 登录 | 立即注册

返回顶部