根据福娃贴“一个福利吧签到脚本”,增加论坛地址自动更新,不再怕论坛改地址

本帖最后由 victor_1 于 2019614 10:43 编辑
感谢福娃贴一个福利吧签到脚本
他的内容

根据福娃贴“一个福利吧签到脚本”,增加论坛地址自动更新,不再怕论坛改地址

本帖最后由 victor_1 于 2019614 10:43 编辑

感谢福娃贴一个福利吧签到脚本

他的内容,不再解释。

作为新手,学习后,在他贴基础上增加根据福利吧地址发布页来更新论坛,不再担心论坛地址更新,只怕福利吧地址发布页换地址咯

下面是代码

# * coding: utf8 *

import requests

import re

import time

import chardet

from urllib.parse import quote

from urllib import request

def start():

try:

#福利吧地址发布页,获取最新签到地址

issue_url = ‘http://www.lao4g.com/’

def getHtml(pageUrl):

response = request.urlopen(pageUrl)

raw_html = response.read()

getEncoding = chardet.detect(raw_html)[‘encoding’]

src = raw_html.decode(getEncoding, ‘ignore’)

url=re.findall(r’

[\s]*?福利吧论坛地址[\s]*?’, src,re.I)

response.close()

#print(url[0])

return url[0]

url=getHtml(issue_url)

#print(url)

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’,

‘AcceptLanguage’:’zhCN,zh;q=0.9′,

‘cachecontrol’:’maxage=0′,

‘Host’:url,

‘UserAgent’: ‘Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.25 Mobile Safari/537.36’}

login_url = ‘http://’+url+’/member.php?mod=logging&action=login&loginsubmit=yes&loginhash=LaEK9&mobile=2&handlekey=loginform&inajax=1’

#s.get(‘http://’+url+’/’)

#s.get(‘http://’+url+’/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(‘http://’+url+’/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(‘http://’+url+’/’+ qiandao_url ).text

#获取积分

user_info = s.get(‘http://’+url+’/forum.php?mobile=no’).text

current_money = re.search(r'(.*?)’, user_info).group(1)

print(current_money)

#requests.get(‘https://sc.ftqq.com/SCKEY.send?text=’ + quote(‘wnflb自动签到成功~’+time.strftime(‘%Y.%m.%d’,time.localtime(time.time()))) +’&desp=’+quote(current_money))

except Exception as e:

print(“签到失败,通知SERVER酱!”+str(e))

requests.get(‘https://sc.ftqq.com/SCKEY.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()复制代码

发布页改版,修改了一下发布页的获取格式。强烈不建议抢凌晨签到,服务器的负载会加大。

纯手打。求张国立~~

2楼:牛逼,赶过来支持一下

3楼:车已经有了。司机呢?司机去哪里了

4楼:不错不错,你真是太棒了,给你一万个赞

5楼:支持一下 .

6楼:怎么用呀这个??

7楼:今天上午我也自己改了下,不过没有去福利吧地址发布页找到,楼主真的想的好深

response = requests.get(‘http://fulibus.net/’)

res_text = response.text

get_url = re.findall(r’href=”(.*?)forum.php”.*?福利吧论坛’,res_text)[0]

这个是我获取地址的正则

然后用%s 替换地址

其实还可以加入查询论坛服务器时间然后抢签到名次,不过这个得好几天调试

8楼:从发布页出发,想得够细节的。

9楼:支持一下!!!

用暴力猴吗

10楼:tampermonkey脚本出错,怎么用啊

11楼:谢谢分享,部署还是挺麻烦的,不弄了

12楼:哈哈,抛砖引玉,签到脚本越来越完善了。大福吧牛逼。

13楼:fengdaokanhai 发表于 2019527 18:18

tampermonkey脚本出错,怎么用啊

看看另一个福娃的帖http://www.wnflb66.com/forum.php … &extra=page%3D1

我是完善一点点而已

14楼:不错不错,这样可以避免换地址了

15楼:感谢楼主,真的强大666

16楼:福吧越来越像个技术开车的地方了

17楼: 测试成功

18楼:测试成功!感谢分享!

19楼:不错。挺好用的。

20楼:楼主能改个52破解的吗 那个是https的

21楼:一直在请选择运行角色是什么意思

22楼:支持一下

23楼:已经不行了,登陆重定向

24楼:本帖最后由 mtyc 于 2019613 01:33 编辑

url = re.findall(r’

[\s]*?福利吧论坛地址[\s]*?’, src,re.I)

发布页改版了吗?修改了一下,不过还是不行,不知道什么问题用没有获取发布页地址的那个版本反而还可以得到一个签到失败的提示

返回结果:

{“errorCode”:1,”errorMessage”:”Task timed out after 3 seconds”}

25楼:返回结果:

{“errorCode”:1,”errorMessage”:”Task timed out after 3 seconds”}

26楼:签到失败,通知SERVER酱!list index out of range

27楼:荆棘谷的青山 发表于 2019527 15:24

今天上午我也自己改了下,不过没有去福利吧地址发布页找到,楼主真的想的好深

response = requests.get(‘htt …

查询论坛服务器时间怎么搞的?

28楼:jsxyhyj 发表于 2019613 09:52

查询论坛服务器时间怎么搞的?

发出请求后服务器返回的header信息

import urllib.request

import time

def get_webservertime(url):

# 返回一个对象

response = urllib.request.urlopen(url)

# 打印出远程服务器返回的header信息

# print (response.info())

header = response.info()

ts = header._headers[1][1]

# 将GMT时间转换成北京时间

ltime = time.strptime(ts[5:25], “%d %b %Y %H:%M:%S”)

ttime = time.localtime(time.mktime(ltime) + 8 * 60 * 60)

dat = “%u%02u%02u” % (ttime.tm_year, ttime.tm_mon, ttime.tm_mday)

tm = “%02u:%02u:%02u” % (ttime.tm_hour, ttime.tm_min, ttime.tm_sec)

print(dat, tm)

print(‘服务器时间:’)

get_webservertime(‘http://www.wnflb66.com/forum.php’)

print(‘本地时间:’)

ticks = time.asctime( time.localtime(time.time()) )

print (ticks)

exit()

29楼:荆棘谷的青山 发表于 2019613 09:57

发出请求后服务器返回的header信息

import urllib.request

好的,谢谢

30楼:小猴子 发表于 2019613 09:45

签到失败,通知SERVER酱!list index out of range

主页返回的内容变了

(0)

相关推荐