京东自动评论脚本_京东时光机python脚本 自动完成任务

其他的活动大家都玩的很嗨,这个貌似没什么动静

活动大概就是积碎片兑换奖励,奖励没怎么注意自己去看吧

活动地址:https://h5.m.jd.com/babelDiy/Zeus/3DDunaJMLDamrmGwu73QbqtGtbX1/index.html

脚本参数&使用方法:

1、python脚本,需要自己输入cookie,cookie的获取方法就不多说了,自己去页面抓下即可或者使用那个pc版全民营业生成的ck也可以的(DDG_Cookie.ddg)文件里的,放进单引号中

cda572d6faab6e371225f4e2a310efd8.png

2、里边有个sleep_num参数,请求间隔,默认3s,嫌慢的自己去改下即可

3、里边还有两个参数,经纬度(lat和lnt),这个默认我写的有(深圳的经纬度),在data中,定位附近的店铺的,可以自己去百度自己的经纬度改改,也可以不改

直接运行即可,需要pip install requests库,之前玩过吧里其他python脚本的应该都安过了

我自己搞了3个号暂时都没啥问题,截图

16dc94abdd1ec59f10a5954a7106f098.png   8e647a0e1259010981e77d9312a3b828.png

代码下载:

https://meituan.lanzous.com/b0f7xlrqf  (密码:2468)

代码如下:

import requests
import time
import json
import urllib3
urllib3.disable_warnings()
#请求延迟时间单位s
sleep_num = 3
Cookie = ''
url = "https://api.m.jd.com/client.action"
headers = {
    'User-Agent': 'jdapp;Mozilla/5.0 (Linux; U; Android 7.0; zh-CN; BAC-TL00 Build/HUAWEIBAC-TL00) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/57.0.2987.108 UCBrowser/11.6.4.950 UCBS/2.11.1.28 Mobile Safari/537.36 AliApp(TB/7.3.0.9) WindVane/8.3.0 1080X1812',
    'Accept': 'application/json',
    'Content-Type': 'application/x-www-form-urlencoded',
    'Origin': 'https://h5.m.jd.com',
    'Referer': 'https://h5.m.jd.com/babelDiy/Zeus/3DDunaJMLDamrmGwu73QbqtGtbX1/index.html?babelChannel=ttt5',
    'Cookie':Cookie
}
def get_shop_id():
    data = 'functionId=bc_getHome&appid=publicUseApi&body={"lat":"22.539604","lng":"114.111027"}&t=%s&client=wh5&clientVersion=1.0.0' % int(round(time.time() * 1000))
    data1 = 'functionId=bc_taskList&appid=publicUseApi&body={"lat":"22.539604","lng":"114.111027"}&t=%s&client=wh5&clientVersion=1.0.0' % int(round(time.time() * 1000))
    try:
        response = requests.post(url,headers=headers,data=data,verify=False).json()
        res = response.get('data','').get('result','').get('homeAdvertVO','')
        nearbystoreid = []
        sendstoreid = []
        pluscomments0=[]
        t1comments0=[]
        nearbyShopList = res.get('nearbyShopList','')
        nearbyShopProgress = res.get('nearbyShopProgress').split('/')
        nearbyShoptimes = int(nearbyShopProgress[1]) - int(nearbyShopProgress[0])
        for i in range(0,nearbyShoptimes):
            nearbyShopid = nearbyShopList[i].get('storeid','')
            nearbystoreid.append(nearbyShopid)
        sendHomeShopList = res.get('sendHomeShopList','')
        sendHomeShopProgress= res.get('sendHomeShopProgress','').split('/')
        sendHomeShoptimes = int(sendHomeShopProgress[1]) - int(sendHomeShopProgress[0])
        for s in range(0,sendHomeShoptimes):
            sendHomeShopid = sendHomeShopList[s].get('storeid','')
            sendstoreid.append(sendHomeShopid)
        plusAdvertList = res.get('plusAdvertList','')
        tplusProgress=res.get('tplusProgress','').split('/')
        plustimes = int(tplusProgress[1]) - int(tplusProgress[0])
        for t in range(0,plustimes):
            plusShopid = plusAdvertList[t].get('comments0','')
            pluscomments0.append(plusShopid)
        t1AdvertList = res.get('t1AdvertList','')
        t1Progress=res.get('t1Progress','').split('/')
        t1times = int(t1Progress[1]) - int(t1Progress[0])
        for v in range(0,t1times):
            t1Shopid = t1AdvertList[v].get('comments0','')
            t1comments0.append(t1Shopid)
        return nearbystoreid,sendstoreid,pluscomments0,t1comments0
    except:
        print("其他错误,退出重试")
def add_shopexe(storeId,storeType):
    data = {
        'functionId':'bc_doTask',
        'appid':'publicUseApi',
        'body':'{"taskType":4,"storeId":"%s","storeType":%s,"lat":"22.539604"}' % (storeId,storeType),
        't':int(round(time.time() * 1000)),
        'client':'wh5',
        'clientVersion':'1.0.0'
    }
    res = requests.post(url,headers=headers,data=data,verify=False).json()
    if res.get('data').get('bizCode') == 0:
        print('任务完成,送你%s能量' % res.get('data').get('result').get('energy'))
    else:
        print(res.get('data').get('bizMsg'))
def add_shopexe1(taskType,shopid):
    data = {
        'functionId':'bc_doTask',
        'appid':'publicUseApi',
        'body':'{"taskType":%s,"shopId":"%s"}' % (taskType,shopid),
        't':int(round(time.time() * 1000)),
        'client':'wh5',
        'clientVersion':'1.0.0'
    }
    res = requests.post(url,headers=headers,data=data,verify=False).json()
    if res.get('data').get('bizCode') == 0:
        print('任务完成,送你%s能量' % res.get('data').get('result').get('energy'))
    elif res.get('data').get('bizCode') == 302 or 311 or 312:
        return res.get('data').get('bizCode')
    else:
        print('其他错误')
nearbystoreid,sendstoreid,pluscomments0,t1comments0 = get_shop_id()
#逛同城附近
print("开始逛同城附近好店")
for nearbystoreId in nearbystoreid:
    print(nearbystoreId)
    if nearbystoreId:
        add_shopexe(nearbystoreId,2)
        time.sleep(sleep_num)
for sendstoreId in sendstoreid:
    print(sendstoreId)
    if sendstoreId:
        add_shopexe(sendstoreId,1)
        time.sleep(sleep_num)
print("逛同城附近好店任务已经完成了")
time.sleep(1)
#逛大牌
print("开始逛“大牌”品牌店铺")
for t1comments0Id in t1comments0:
    print(t1comments0Id)
    if t1comments0Id:
        add_shopexe1(2,t1comments0Id)
        time.sleep(sleep_num)
print("逛“大牌”品牌店铺任务已经完成了")
time.sleep(1)
#逛超级
print("开始逛“超级”品牌店铺")
for pluscomments0Id in pluscomments0:
    print(pluscomments0Id)
    if pluscomments0Id:
        add_shopexe1(1,pluscomments0Id)
        time.sleep(sleep_num)
print("逛“超级”品牌店铺任务已经完成了")
time.sleep(1)
#AR
print("开始逛AR")
s = add_shopexe1(6,'')
print("逛AR完成了")
time.sleep(1)
#逛精选会场
print("开始逛精选会场")
for i in range(0,6):
    s = add_shopexe1(5,'')
    if s == 311:
        break
    time.sleep(sleep_num)
print("逛精选会场完成了")
time.sleep(1)
#逛精选店铺
print("开始逛“精选”品牌店铺")
for i in range(0,40):
    s = add_shopexe1(3,'')
    if s == 302:
        break
    time.sleep(sleep_num)
print("逛“精选”品牌店铺完成了")
print("the end")

49b78679d2d485d0166a4c4c04ab14a6.gif更多活动(请点击“

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值