这篇文章将为大家详细讲解有关如何使用树莓派自动签到贴吧,文章内容质量较高,因此小编分享给大家做个参考,希望大家阅读完这篇文章后对相关知识有一定的了解。
crontab -e
3 0 * * * nohup python -u /home/pi/work/baidu/check_in.py > /home/pi/work/logs/baidu/check_in.log 2>&1 & 3 0 * * * python /home/pi/work/jd/check_in.py
# coding: utf-8 import sys reload(sys) sys.setdefaultencoding( "utf-8" ) import requests import re num = 0 num_error = 0 ok_num = 0 error_num = 0 Cookie = 'Your cookie' headers = { 'Accept':'application/json, text/javascript, */*; q=0.01', 'Accept-Encoding': 'gzip, deflate', 'Accept-Language': 'zh-CN,zh;q=0.8,en;q=0.6', 'Connection': 'keep-alive', 'Content-Length': '61', 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8', 'Cookie': Cookie, 'DNT': '1', 'Host': 'tieba.baidu.com', 'Origin': 'http://tieba.baidu.com', 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.130 Safari/537.36', 'X-Requested-With': 'XMLHttpRequest', } headers1 = { "Accept":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8", "Accept-Encoding":"gzip, deflate, sdch", "Accept-Language":"zh-CN,zh;q=0.8", "Cache-Control":"max-age=0", "Connection":"keep-alive", "Cookie": Cookie, "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
关于如何使用树莓派自动签到贴吧就分享到这里了,希望以上内容可以对大家有一定的帮助,可以学到更多知识。如果觉得文章不错,可以把它分享出去让更多的人看到。
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。