使用树莓派自动签到贴吧,京东
使用树莓派自动签到贴吧,京东
lykin1972 发表于1年前
使用树莓派自动签到贴吧,京东
  • 发表于 1年前
  • 阅读 37
  • 收藏 0
  • 点赞 0
  • 评论 0

腾讯云 技术升级10大核心产品年终让利>>>   

摘要: 转载请注明出处

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

over

标签: 树莓派
共有 人打赏支持
粉丝 0
博文 8
码字总数 3986
×
lykin1972
如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!
* 金额(元)
¥1 ¥5 ¥10 ¥20 其他金额
打赏人
留言
* 支付类型
微信扫码支付
打赏金额:
已支付成功
打赏金额: