您好,登錄后才能下訂單哦!
這篇文章將為大家詳細講解有關如何使用樹莓派自動簽到貼吧,文章內容質量較高,因此小編分享給大家做個參考,希望大家閱讀完這篇文章后對相關知識有一定的了解。
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進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。