How to use raspberry pie to automatically check in
This article will explain in detail how to use raspberry pie automatic check-in bar, the content of the article is of high quality, so the editor shares it for you as a reference. I hope you will have some understanding of the relevant knowledge after reading this article.
Crontab-e
30 * nohup python-u / home/pi/work/baidu/check_in.py > / home/pi/work/logs/baidu/check_in.log 2 > & 1 & 30 * python / home/pi/work/jd/check_in.py# coding: utf-8import sysreload (sys) sys.setdefaultencoding ("utf-8") import requestsimport renum = 0num_error = 0ok_num = 0error_num = 0Cookie = 'Your cookie'headers = {' Accept':'application/json, text/javascript * / * Qcow 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': '1century,' 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', 'Xmuri Requestedmuri Withballs:' XMLHttpRequest' } headers1 = {"Accept": "text/html,application/xhtml+xml,application/xml" Qcoach 0.9 gzip deflate sdch, "Accept-Language": "zh-CN,zh" Qroom0.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_forumnum = 0num_error = 0ok_num = 0error_num = 0pid = Truewhile 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": "pro You've signed it before. " "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 = Falseprint 'over'# Coding: utf-8import requestsimport re# Please replace your cookie here.Cookie = "" headers = {"Accept": "text/html Application/xhtml+xml,application/xml Qcoach 0.9, deflate, sdch, br, Accept-Language: "zh-CN,zh" Qroom0.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_forumr = 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_forumr2 = requests.get (url_forum, headers=headers) print r2.textheaders = {"Accept": "* / *", "Accept-Encoding": "gzip, deflate, br", "Accept-Language": "zh-CN,zh" Qroom0.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_forumr = 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_forumr = requests.post (url_forum, headers=headers) print r.texturl_forum = 'http://ld.m.jd.com/SignAndGetBeans/signStart.action?sid=210aafce2985f69c0ebfeae0f5459fbw'r = requests.get (url_forum) print' curl', url_forumprint r.text on how to use the raspberry pie to automatically check in the post bar, so much for sharing. I hope the above content can be of some help to you and learn more knowledge. If you think the article is good, you can share it for more people to see.