天天动画片 > 八卦谈 > 福利吧自动签到脚本

福利吧自动签到脚本

八卦谈 佚名 2022-10-24 10:28:33

2020年8月28日 19:11:36更新

测试结果显示“Invoking task timed out after 3 seconds”的请看文章最后

利用腾讯云的无服务器云函数。免费部署。如果签到失败,微信提醒(server酱)。

先要准备2个东西。
1.qq或微信账号,这个都有,用来登录腾讯云
2.server酱推送地址

在下面的网站里获取server酱推送地址,跟着提示来就行,(需要github账号登录)

http://http://sc.ftqq.com/

开通并使用上它,只需要一分钟:(最近打开会有些慢)

登入:用GitHub账号登入网站,就能获得一个SCKEY(在「发送消息」页面)
绑定:点击「微信推送」,扫码关注同时即可完成绑定
发消息:往 http://http://sc.ftqq.com/SCKEY.send 发GET请求,就可以在微信里收到消息啦


最后获得类似这样的一串代码,保存,后面会用到:

https://http://sc.ftqq.com/SCU43934T12d12b084**************bd579bf5e875.send


●准备工作完毕


用qq或者微信登录腾讯云scf(无服务器云函数)现在需要实名认证

https://http://console.cloud.tencent.com/scf

函数服务=》(选择区域,上海,广州,成都,香港,北京)
=》新建=》空白函数=》函数名称(随便写,比如fuliba_qiandao)=》运行环境(python3.6)=》下一步


复制如下代码:(把代码粘贴进到 index.py里)

或者从网盘里复制粘贴:https://wwa.lanzous.com/b0742aloj

# -*- coding: utf8 -*-


import requests

import re

import time

from urllib.parse import quote


def start():

    try:

        s = requests.session()

        username = '填你的账号'

        password = '填你的密码'


        headers = {'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8',

                   'Accept - Encoding':'gzip, deflate, br',

                   'Accept-Language':'zh-CN,zh;q=0.9',

                   'cache-control':'max-age=0',

                   'Host':'www.wnflb2020.com',

                   'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 10_3 like Mac OS X) AppleWebKit/602.1.50 (KHTML, like Gecko) CriOS/56.0.2924.75 Mobile/14E5239e Safari/602.1'}


        login_url = 'https://www.wnflb2020.com/member.php?mod=logging&action=login&loginsubmit=yes&loginhash=Lh0Ed&mobile=2&handlekey=loginform&inajax=1'


        s.get('https://www.wnflb2020.com/')

        s.get('https://www.wnflb2020.com/member.php?mod=logging&action=login&mobile=2')


        r = s.post(login_url, {'fastloginfield':'username',"username": username, 'password': password,'questionid':0,'answer':''}, headers=headers)

        

        #访问Pc主页获取积分

        user_info = s.get('https://www.wnflb2020.com/forum.php?mobile=no').text

        

        #获取签到链接,并签到

        qiandao_url = re.search(r'}function fx_checkin(.*?);', user_info).group(1)

        qiandao_url = qiandao_url[47:-2]

        print(qiandao_url)

        #签到

        s.get('https://www.wnflb2020.com/'+ qiandao_url ).text


        #获取积分

        user_info = s.get('https://www.wnflb2020.com/forum.php?mobile=no').text

        current_money = re.search(r'<a.*? id="extcreditmenu".*?>(.*?)</a>', user_info).group(1)

        print(current_money)


    except Exception as e:

        print("签到失败,通知SERVER酱!")

        requests.get('https://sc.ftqq.com/SERVER酱代码.send?text=' + quote('wnflb自动签到失败~'+time.strftime('%Y.%m.%d',time.localtime(time.time()))) +'&desp='+quote('异常代码:\n'+str(e)))




def main_handler(event, context):

    return start()



if __name__ == '__main__':

    start()


代码中需要自己修改地方有3处:
1、填你的账号
2、填你的密码
3、修改https://http://sc.ftqq.com/SERVER酱代码.send里的SCEKEY酱代码

(改成酱代码SCU开头的代码,签到失败就会自动微信通知了)↓↓如图所示↓↓


=》完成。

=》触发方式=》定时触发 / 名称:fuli_qiandaobiao / 自定义触发周期(0 0 6 * * * *) / =》保存

=》函数代码=》测试(如果能显示积分。就算登录成功了)


●其他说明

自定义触发周期(0 0 6 * * * *)这个是每天6点自动签到,也可以改成其他时间,0点不建议,论坛的签到貌似是0点过一会才能点击签到。

如果不需要微信通知,可以注释那一行地址(前面加个#):
#requests.get('https://http://sc.ftqq.com/

在【运行日志】里。可以查看每次执行的结果。。。只要日志里有显示“积分:xx”就是签到成功了(如图所示↓↓↓)

前几天福利吧改域名了,这几天太忙没时间更改,所以出了好多签到错误,无视就好。

用户名密码错误。也会触发微信提醒。



在腾讯云函数里执行超时时间上修改成10秒,再测试就OK了。(如图所示)


本文标题:福利吧自动签到脚本 - 八卦谈
本文地址:www.ttdhp.com/article/4957.html

天天动画片声明:登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述。
扫码关注我们