这篇文章将为大家详细讲解有关如何使用树莓派自动签到贴吧,文章内容质量较高,因此小编分享给大家做个参考,希望大家阅读完这篇文章后对相关知识有一定的了解。
crontab -e
30 * * * nohupython-u/home/pi/work/百度/check in _ in。py/home/pi/work/log/Baidu/check _ in。日志21
30 * * * python/home/pi/work/JD/check in _ in。py #编码: utf-8
importsys
重新加载(系统)
sys.setdefaultencoding('utf-8 ')
导入请求
进口
num=0
num_error=0
ok_num=0
error_num=0
Cookie='您的饼干
标题={ 0
接受' : '应用/json,text/javascript,*/*;q=0.01 ',
接受-编码:'gzip,放气',
接受-语言:'zh-CN,zh;q=0.8,en;q=0.6 ',
连接' : '保持活动状态,
内容-长度' :'61 ',
内容类型' : '应用程序/x-www-form-URL编码;字符集=UTF-8 ',
Cookie':Cookie,
DNT':'1 ',
主机:'tieba.baidu.com,
产地' : ' http://铁霸。百度。' com ',
用户代理: ' Mozilla/5.0(window snt 6.1)applebwebkit/537.36(KHTML,likeGecko)Chrome/43。0 .2357 .130 safari/537.36 ',
x-请求-带有:'XMLHttpRequest ',
}
标题S1={ 0
接受' : '文本/html,应用程序/xhtml xml,应用程序/XML;q=0.9,image/webp,*/*;q=0.8 ',
接受-编码:'gzip,deflate,sdch ',
接受-语言:'zh-CN,zh;q=0.8 ',
缓存控制' : '最大年龄=0 ',
连接' : '保持活动状态,
Cookie':C
ookie,
"Host":"tieba.baidu.com",
"Upgrade-Insecure-Requests":"1",
"User-Agent":"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.116 Safari/537.36"
}
url_forum = 'http://tieba.baidu.com/f/like/mylike'
r2 = requests.get(url_forum, headers=headers1)
search = re.findall(ur'a href=.*?title="(.+?)">', r2.text)
num_forum = len(search)
print 'num_forum', num_forum
num = 0
num_error = 0
ok_num = 0
error_num = 0
pid = True
while num != num_forum and pid:
for i in search:
payload = {'ie': 'utf-8', 'kw': i, 'tbs': 'fb6ecec1996df5d41435580832'}
r = requests.post('http://tieba.baidu.com/sign/add', data=payload, headers=headers, timeout=3)
html = r.text.decode('raw_unicode_escape')
print "%s %s ..." % ("Execute task:", i)
if html == u'{"no":1101,"error":"亲,你之前已经签过了","data":""}':
ok_num += 1
print "%s is repeat task." % i
else:
ok_num += 1
print "%s finished." % i
if ok_num == num_forum:
pid = False
else:
error_num += 1
if error_num == 5:
pid = False
print 'over'
# coding: utf-8 import requests import re # Please replace your cookie here. Cookie = "" headers = { "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8", "Accept-Encoding": "gzip, deflate, sdch, br", "Accept-Language": "zh-CN,zh;q=0.8", "Cache-Control": "max-age=0", "Connection": ":keep-alive", "Cookie": Cookie, "Host": "vip.jd.com", "Upgrade-Insecure-Requests": "1", "User-Agent": "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.116 Safari/537.36" } url_forum = 'http://vip.jd.com' print 'curl', url_forum r = requests.get(url_forum, headers=headers) isLogin = re.findall(ur'pageConfig.isLogin="(.+?)"', r.text) token = re.findall(ur'pageConfig.token="(.+?)"', r.text) print 'token :', token[0], ', isLogin:', isLogin[0] url_forum = 'https://vip.jd.com/common/signin.html?token='+token[0] print 'curl', url_forum r2 = requests.get(url_forum, headers=headers) print r2.text headers = { "Accept": "*/*", "Accept-Encoding": "gzip, deflate, br", "Accept-Language": "zh-CN,zh;q=0.8", "Connection": ":keep-alive", "Cookie": Cookie, "Host": "vip.jr.jd.com", "Origin": "https://vip.jr.jd.com", "Referer": "https://vip.jr.jd.com/", "X-Requested-With": "XMLHttpRequest", "User-Agent": "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.116 Safari/537.36" } url_forum = 'https://vip.jr.jd.com/newSign/doSign' print 'curl', url_forum r = requests.post(url_forum, headers=headers) print r.text # Glod lottery, once everyday. url_forum = 'http://vip.jr.jd.com/award/drawAward' #url_forum = ' http://vip.jr.jd.com/newSign/doSign' print 'curl', url_forum r = requests.post(url_forum, headers=headers) print r.text url_forum = 'http://ld.m.jd.com/SignAndGetBeans/signStart.action?sid=210aafce2985f69c0ebfeae0f5459fbw' r = requests.get(url_forum) print 'curl', url_forum print r.text
关于如何使用树莓派自动签到贴吧就分享到这里了,希望
内容来源网络,如有侵权,联系删除,本文地址:https://www.230890.com/zhan/105874.html