京东星推官自动领取京豆python脚本

  • 作者:admin
  • 分类:活动
  • 发布时间:2020.11.01 23:28
  • 阅读:2932

    京东星推官自动领取京豆python脚本


    这个是去年的脚本,已失效


    前两天发了个时光机的脚本,有吧友发来个领京豆的活动,今天空了顺带写了下


    活动差不多每天0点开始,京豆有限,差不多几分钟的时间把,每天应该可以几百豆子,可以0点去试试


    活动地址:https://pro.m.jd.com/mall/active/3gSzKSnvrrhYushciUpzHcDnkYE3/index.html


    脚本使用方法:


    1.python脚本运行需要python环境,这次cookie的获取直接使用pc版全民营业的cookie使用的

    直接将脚本放在全民营业的文件夹中即可,读取的是DDG_Cookie.ddg文件的ck

     

    没用那个软件的可以自己把9/10行注释了,11行自己填Cookie


    2.脚本只做了任务2和任务3,其他任务自己去看看把


    3.脚本依赖requests库,由于之前有吧友私信不咋会python,今天会打包个exe(python打出来的包较大,不放心的直接用脚本即可)


    我之前测试了应该没啥问题,有问题留言把


    脚本和exe下载地址:https://meituan.lanzous.com/b0f7xs1vg


    代码如下:

    import requests
    import time
    import json
    import urllib3
    urllib3.disable_warnings()
    
    print(time.strftime("%Y-%m-%d %H:%M:%S",time.localtime(int(time.time()))))
    
    ck = open('DDG_Cookie.ddg','r')
    Cookie = ck.read()
    # Cookie = ''
    
    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://pro.m.jd.com/mall/active/3gSzKSnvrrhYushciUpzHcDnkYE3/index.html',
        'Cookie':Cookie
    }
    
    def get_starId():
        url = 'https://urvsaggpt.m.jd.com/guardianstar/getFrontConfig?t=&starId=fangtai'
        response = requests.get(url,verify=False).json()
        if response.get('code','') == 200:
            res = response.get('data','').get('shareInfo','').get('shareMessage','')
            starIds = []
            for i in res:
                starIds.append(i.get('starId',''))
            print(starIds)
            return starIds
        else:
            print('其他')
    
    def add_jd(starId,types,ids,status):
        url = 'https://urvsaggpt.m.jd.com/guardianstar/doTask'
        data = 'starId=%s&type=%s&id=%s&status=%s' % (starId,types,ids,status)
        try:
            response = requests.post(url,data=data,headers=headers,verify=False).json()
            if response.get('code','') == 200 and status == 1:
                print('店铺:%s进入成功' % ids)
            elif response.get('code','') == 200 and status == 2:
                print('领取成功,获得{}个京豆,{}守护星'.format(response.get('data','').get('bean',''),response.get('data','').get('star','')))
            else:
                print(response.get('msg',''))
        except:
            print('其他')
    
    def get_task(starId):
        # url1 = 'https://urvsaggpt.m.jd.com/guardianstar/getFrontConfig?t=%s&starId=%s' % (int(round(time.time() * 1000)),starId)
        # url2 = 'https://urvsaggpt.m.jd.com/guardianstar/getPrizeNotice?t=%s&starId=%s' % (int(round(time.time() * 1000)+10),starId)
        # url3 = 'https://urvsaggpt.m.jd.com/guardianstar/getActivityConfig?t=%s&starId=%s' % (int(round(time.time() * 1000)+20),starId)
        # url4 = 'https://urvsaggpt.m.jd.com/guardianstar/getRule?t=%s&starId=%s' % (int(round(time.time() * 1000)+30),starId)
    
        url = 'https://urvsaggpt.m.jd.com/guardianstar/getHomePage?t=%s&starId=%s' % (int(round(time.time() * 1000)+40),starId)
        try:
            # resp = requests.get(url1,verify=False,headers=headers).json()
            # resp = requests.get(url2,verify=False,headers=headers).json()
            # resp = requests.get(url3,verify=False,headers=headers).json()
            # resp = requests.get(url4,verify=False,headers=headers).json()
    
            response = requests.get(url,verify=False,headers=headers).json()
            if response.get('code','') == 200:
                res = response.get('data','')[0]
                venueIdlist = []
                productIdlist = []
                #任务2
                for i in res.get('venueList',''):
                    if i.get('venueStatus','') != 3:
                        venueId = i.get('venueId','')
                        add_jd(starId, 'venue',venueId, 1)
                        venueIdlist.append(venueId)
                        time.sleep(1)
                #任务3
                for j in res.get('productList',''):
                    if j.get('productStatus') != 3:
                        productId = j.get('productId','')
                        add_jd(starId, 'product',productId, 1)
                        productIdlist.append(productId)
                        time.sleep(1)
                lens = len(venueIdlist) + len(productIdlist)
                if lens > 10:
                    pass
                elif lens == 0:
                    pass
                else:
                    len_num = 10 - lens
                    print('等%s秒在继续' % len_num)
                    time.sleep(len_num)
                #领取
                for i in res.get('venueList',''):
                    if i.get('venueStatus','') != 3:
                        venueId = i.get('venueId','')
                        add_jd(starId, 'venue',venueId, 2)
                        time.sleep(1)
                for j in res.get('productList',''):
                    if j.get('productStatus') != 3:
                        productId = j.get('productId','')
                        add_jd(starId, 'product',productId, 2)
                        time.sleep(1)
            else:
                print(response.get('msg',''))
        except:
            print('其他')
    
    starIds = get_starId()
    for starId in starIds:
        get_task(starId)
    print(time.strftime("%Y-%m-%d %H:%M:%S",time.localtime(int(time.time()))))
    input("搞完了,请按回车键退出")


微信公众号:薅羊毛活动网
小程序转二维码微信机器人:关注公众号回复 转码
点击这里给我发消息
嘿!有什么能为您效劳的吗?