sword

京东商品(口罩)有货监控并抢购(自动下单)
一、概述最近新冠状病毒影响,口罩等防护用品成为稀缺资源,虽然都在提倡戴口罩,但是买不到怎么戴?博主就1月20日戴过...
扫描右侧二维码阅读全文
12
2020/02

京东商品(口罩)有货监控并抢购(自动下单)

一、概述

最近新冠状病毒影响,口罩等防护用品成为稀缺资源,虽然都在提倡戴口罩,但是买不到怎么戴?博主就1月20日戴过一次,之后再也没戴过,不是博主不想戴,实在是没有啊!!!于是无聊闷在家发现了一个抢口罩的项目,本着分享的精神分享给大家!

二、简介

jdBuyMask采用python编写,支持京东监控口罩是否有货,并自动下单
功能
1、检查登录
2、确认是否有货
3、有货自动下单
4、邮件、微信通知

项目地址:https://github.com/cycz/jdBuyMask
衍生项目地址:https://github.com/Rlacat/jd-automask
衍生项目地址:https://github.com/cexll/jdBuyMask

三、使用教程

1、环境要求:python3.6以上(点击下载python,自行安装配置);
2、下载源码,并解压;
3、修改配置文件configDemo.ini(如下图),(请勿使用记事本编辑,建议用notepad++)
请输入图片描述

3.1 area地区id设置(就是自己的下单送货位置)
用谷歌浏览器京东随便找一个商品,点击选择你的地区,F12或者鼠标右键-->检查,打开开发者工具,过滤出stock,找到area=19_1607_3639_0,复制数字和下划线,粘贴到文件内

请输入图片描述

3.2 cookies设置
登录京东账号,点击我的订单,F12或者鼠标右键-->检查,打开开发者工具--->切换到NetWork,然后按一下F5或者刷新一下页面、会出现大量的url,过滤出list.action,下滑找到Cookie,复制然后粘贴到文件内。(注意Cookie很长,别漏了)
请输入图片描述

3.3 推送方式
推荐server酱微信推送的方式,打开http://sc.ftqq.com/3.version,微信登录并绑定,选中发送消息栏即可获取SCKEY
请输入图片描述

3.4 skuid 商品id获取

选中并打开自己想抢购的商品,中间的数字就是商品id
请输入图片描述

3.5 抢购设置
博主一般选中V2版本,复制商品id放到V2中的skuid中(注意最后一个商品不要加逗号,数量不要超过99)
请输入图片描述

3.6 运行程序
1、对于windows系统,搜索cmd,打开命令行工具,
请输入图片描述

2、切换到脚本所在目录
我的脚本放在F盘的codejdBuyMask-master_2_11文件夹,依次执行以下命令,每执行一条回车确认

#切换盘符
F:
#切换目录
cd F:\code\jdBuyMask-master_2_11

请输入图片描述

3、安装依赖
依次执行以下命令,每执行一条回车确认

#升级pip
python -m pip install --upgrade pip -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com
#导入需要的包
pip install -r requirements.txt -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com
#运行
python jdBuyMask_V2.py

四、程序说明

1、V2版本只能抢“不用预约的商品”,抢预约的商品会一直加购物车,V3版本只能抢预约后定时抢购的的商品!
用V3版本时运行命令 python jdBuyMask_V3.py

2、软件支持多开,多开时只需要重新开一个命令行窗口直接运行python jdBuyMask_V2.pypython jdBuyMask_V3.py即可

3、V2版本
请在configDemo.ini 加入商品id、地区id、cookie等参数 区分下单模式(默认2正常模式)
注意--极速模式默认清空购物车

正常模式下单流程(1.7秒左右):
检测有货--检测下柜--加入购物车--查看购物车--下单

极速模式下单流程(1.4秒左右):
检测有货--加入购物车--下单

4、V3版本(下单更快)
下单更快,但只能扫描单独一件商品
在配置文件configDemo.ini中,填写[V3]下面的skuid
注意--V3版本默认清空购物车

V3版本下单流程(1秒左右):
提前加入购物车--检测有货--下单

5、exe版本
链接:https://pan.baidu.com/s/1bgGXsH071GkHWGlLIwgRVw 提取码:do3f

已失效,需要的请进入项目地址,阅读源码寻找作者建立的QQ群。

6、注意事项

  • 避免抢购,程序自动一次只买一件
  • 在京东购物车结算页面设置发票为电子普通发票-个人设置支付方式为在线支付
  • 地区id不知道如何获取的,请使用AreaTool.py获取
  • 如果有红包先花掉再开脚本,不然可能需要支付密码
  • 出现下单地址不是默认地址的,在线下一单,取getOrderInfo.action链接的cookie
  • 京东的cookie有效时间只有24小时,每24小时需要自行获取cookie更新。
Last modification:March 1st, 2020 at 09:19 pm
If you think my article is useful to you, please feel free to appreciate

Leave a Comment

52 comments

  1. 三少爷   ( Windows 10 x64 Edition Windows 10 x64 Edition / Google Chrome 84.0.4147.125 Google Chrome 84.0.4147.125 )

    Temporary.eid=
    Temporary.fp=
    这两个值怎么配置呢?代码里是空的

    1. sword   ( Windows 10 x64 Edition Windows 10 x64 Edition / Google Chrome 84.0.4147.135 Google Chrome 84.0.4147.135 )
      @三少爷

      作者已经不开源维护了呢,抢口罩时期过去了

  2. 小虎   ( Windows 10 x64 Edition Windows 10 x64 Edition / 搜狗高速浏览器 搜狗高速浏览器 )
    该评论仅登录用户及评论双方可见
    1. sword   ( Windows 10 x64 Edition Windows 10 x64 Edition / Google Chrome 80.0.3987.122 Google Chrome 80.0.3987.122 )
      @小虎

      不不不,这不是我的作品,我只是分享罢了,作者开源版本不更新了,所以V3可能会有点问题。作者在QQ群里有更新后的版本,群号1053467385

      1. 三少爷   ( Windows 10 x64 Edition Windows 10 x64 Edition / Google Chrome 84.0.4147.125 Google Chrome 84.0.4147.125 )
        @sword

        加群有问题,问题密码是什么?

  3. change   ( Windows 10 x64 Edition Windows 10 x64 Edition / QQ 浏览器 9.0.2524.400 QQ 浏览器 9.0.2524.400 )

    打开文件出现这个 can't open file 'jdBuyMask_V2.py': [Errno 2] No such file or directory

    1. sword   ( Windows 10 x64 Edition Windows 10 x64 Edition / Google Chrome 80.0.3987.122 Google Chrome 80.0.3987.122 )
      @change

      你没切换对路径吧

      1. change   ( Windows 10 x64 Edition Windows 10 x64 Edition / QQ 浏览器 9.0.2524.400 QQ 浏览器 9.0.2524.400 )
        @sword

        233333我太粗心啦,看了半天都没发现,谢啦

  4. xht   ( Android Futureve Android Futureve / Google Chrome 70.0.3538.64 Google Chrome 70.0.3538.64 )

    文件没了啊

    1. sword   ( Android 8.1.0 Android 8.1.0 / WebView 4.0 WebView 4.0 )
      @xht

      哪个文件?exe?这个失效了,直接用源码搞吧

  5. kakakak_xue   ( Windows 10 x64 Edition Windows 10 x64 Edition / Microsoft Edge 18.18362 Microsoft Edge 18.18362 )

    有预约要求的商品可以使用吗

    1. sword   ( Windows 10 x64 Edition Windows 10 x64 Edition / Google Chrome 80.0.3987.116 Google Chrome 80.0.3987.116 )
      @kakakak_xue

      可以,一般抢用v2,预约后抢购用v3(plus会员不需要预约也可以抢哦)

      1. kakakak_xue   ( Windows 10 x64 Edition Windows 10 x64 Edition / Microsoft Edge 18.18362 Microsoft Edge 18.18362 )
        @sword

        'ok xieixe

  6. Harveylam   ( Windows 10 x64 Edition Windows 10 x64 Edition / Google Chrome 79.0.3945.88 Google Chrome 79.0.3945.88 )

    请问运行的时候报错是什么意思呢?
    Traceback (most recent call last):
    File "jdBuyMask_V2.py", line 10, in
    import requests
    ModuleNotFoundError: No module named 'requests'

    1. sword   ( Windows 10 x64 Edition Windows 10 x64 Edition / Google Chrome 80.0.3987.106 Google Chrome 80.0.3987.106 )
      @Harveylam

      没有requests这个包,自行百度安装

      1. Harveylam   ( Windows 10 x64 Edition Windows 10 x64 Edition / Google Chrome 79.0.3945.88 Google Chrome 79.0.3945.88 )
        @sword

        额。。。刚安装好了,但是发现个问题就是它每刷新一次待预约的就自动把它加到购物车,然后购物车的数量不停的上涨。。。。

        1. sword   ( Android 8.1.0 Android 8.1.0 / WebView 4.0 WebView 4.0 )
          @Harveylam

          v2是抢很多的,不能来抢预约,v3才可以

          1. Harveylam   ( Windows 10 x64 Edition Windows 10 x64 Edition / Google Chrome 79.0.3945.88 Google Chrome 79.0.3945.88 )
            @sword

            好的,谢谢,明白

  7. weijiad   ( Windows 10 x64 Edition Windows 10 x64 Edition / QQ 浏览器 10.5.3863.400 QQ 浏览器 10.5.3863.400 )

    为什么显示cookie验证失败

    1. sword   ( Windows 10 x64 Edition Windows 10 x64 Edition / Google Chrome 80.0.3987.106 Google Chrome 80.0.3987.106 )
      @weijiad

      你没设置cookies吧,或者设置错了

  8. Gao   ( Other System Other System / Other Browser Other Browser )

    老大,QQ群号是多少啊

    1. sword   ( Windows 10 x64 Edition Windows 10 x64 Edition / Google Chrome 80.0.3987.106 Google Chrome 80.0.3987.106 )
      @Gao

      1053467385

  9. efwq   ( Windows 7 x64 Edition Windows 7 x64 Edition / Google Chrome 69.0.3497.100 Google Chrome 69.0.3497.100 )

    按着改完了,但是v2和v3执行后都不行啊,买不到而且购物车里也没添加成功

    1. sword   ( Windows 7 x64 Edition Windows 7 x64 Edition / Google Chrome 79.0.3945.117 Google Chrome 79.0.3945.117 )
      @efwq

      不行是什么现象?是验证码识别?提示有货吗?提交订单失败,啥都没有,就说不行?谁知道?

      1. efwq   ( Android 10 Android 10 / WebView 4.0 WebView 4.0 )
        @sword

        就是找了个现在有货的试试,但是运行py之后,京东里订单里没反应,不知道是哪里有问题呢?

        1. sword   ( Windows 7 x64 Edition Windows 7 x64 Edition / Google Chrome 79.0.3945.117 Google Chrome 79.0.3945.117 )
          @efwq

          py里面有提示运行信息的吧,仔细看看提示什么?PS:源码作者已经不更新了(因为有黄牛用这个软件抢口罩来卖),建议加作者群(在源码里面可以找到QQ群),里面有OωO

  10. orange   ( Windows 10 x64 Edition Windows 10 x64 Edition / Microsoft Edge 18.17763 Microsoft Edge 18.17763 )

    exe的版本链接被删除了emm,能不能再发一遍?谢谢了

    1. sword   ( Windows 7 x64 Edition Windows 7 x64 Edition / Google Chrome 79.0.3945.117 Google Chrome 79.0.3945.117 )
      @orange

      额,建议加作者群,源码里面有,找找!

  11. jece   ( Windows 10 x64 Edition Windows 10 x64 Edition / Google Chrome 78.0.3904.108 Google Chrome 78.0.3904.108 )

    同感,你说的有道理。

  12. jece   ( Windows 10 x64 Edition Windows 10 x64 Edition / Google Chrome 78.0.3904.108 Google Chrome 78.0.3904.108 )

    omg,新手小白求完整版教程。。枯了

    1. sword   ( Windows 10 x64 Edition Windows 10 x64 Edition / Google Chrome 80.0.3987.106 Google Chrome 80.0.3987.106 )
      @jece

      如果这个教程还不够详细,那么没有什么是不可能的,只要有钱!

      1. jece   ( Windows 10 x64 Edition Windows 10 x64 Edition / Google Chrome 78.0.3904.108 Google Chrome 78.0.3904.108 )
        @sword

        同感,你说的有道理。

  13. Round   ( Other System Other System / Other Browser Other Browser )

    大佬可以问一下淘宝的skuid怎么获取呢

    1. sword   ( Windows 10 x64 Edition Windows 10 x64 Edition / Google Chrome 80.0.3987.106 Google Chrome 80.0.3987.106 )
      @Round

      这个程序不适用于淘宝天猫,仅限于京东

  14.   ( Windows 10 x64 Edition Windows 10 x64 Edition / Google Chrome 80.0.3987.87 Google Chrome 80.0.3987.87 )

    清空购物车 无效了,手机看一直在增加数量

    1. sword   ( Windows 10 x64 Edition Windows 10 x64 Edition / Google Chrome 80.0.3987.106 Google Chrome 80.0.3987.106 )
      @黄

      |´・ω・)ノ作者已经不更新了,自己改吧

  15. zhuang   ( Windows 10 x64 Edition Windows 10 x64 Edition / Google Chrome 64.0.3282.204 Google Chrome 64.0.3282.204 )

    这个exe版本是不是不支持V3

    1. sword   ( Windows 10 x64 Edition Windows 10 x64 Edition / Google Chrome 80.0.3987.106 Google Chrome 80.0.3987.106 )
      @zhuang

      你邮件写错啦,coom。。。帮你改了

      1. zhuang   ( Windows 10 x64 Edition Windows 10 x64 Edition / Google Chrome 64.0.3282.204 Google Chrome 64.0.3282.204 )
        @sword

        配置文件的邮件地址不是我本地配置的吗,你那边能改?请教下,能否加你QQ

        1. sword   ( Windows 10 x64 Edition Windows 10 x64 Edition / Google Chrome 80.0.3987.106 Google Chrome 80.0.3987.106 )
          @zhuang

          不不不,是你填的评论邮件地址错了,无法收回复

    2. sword   ( Windows 10 x64 Edition Windows 10 x64 Edition / Google Chrome 80.0.3987.106 Google Chrome 80.0.3987.106 )
      @zhuang

      好像是,用过一次就不用了

      1. zhuang   ( Windows 10 x64 Edition Windows 10 x64 Edition / Google Chrome 64.0.3282.204 Google Chrome 64.0.3282.204 )
        @sword

        这周单位复工居然还没口罩,各种抢不到,蛋疼。V3可以直接改配置文件使用?还是exe封装就不支持V3?

        1. sword   ( Windows 10 x64 Edition Windows 10 x64 Edition / Google Chrome 80.0.3987.106 Google Chrome 80.0.3987.106 )
          @zhuang

          没试过,应该不行吧,源码里面V2和V3是两个文件。PS:虽然我抢了三四天也没抢到(不是软件问题,是实在某地基本不放货)。PSS:我司不缺口罩!!!每天发俩|´・ω・)ノ

          1. zhuang   ( Windows 10 x64 Edition Windows 10 x64 Edition / Google Chrome 64.0.3282.204 Google Chrome 64.0.3282.204 )
            @sword

            好的,那我就用exe这个V2版本,找了一个有货的商品试了下跑起来,能正常提交订单(未付款)。就表明程序成功了吧? 我不是开发人员没有python环境,只会简单的用一下exe做一些配置

            1. sword   ( Windows 10 x64 Edition Windows 10 x64 Edition / Google Chrome 80.0.3987.106 Google Chrome 80.0.3987.106 )
              @zhuang

              说明成功了,可以!

              1. zhuang   ( Windows 10 x64 Edition Windows 10 x64 Edition / Google Chrome 64.0.3282.204 Google Chrome 64.0.3282.204 )
                @sword

                好的,谢谢。挂一些商品上去看看。

  16. sololuo   ( iOS 13.3.1 iOS 13.3.1 / Safari 13.0.5 Safari 13.0.5 )
    该评论仅登录用户及评论双方可见
    1. sword   ( Windows 10 x64 Edition Windows 10 x64 Edition / Google Chrome 80.0.3987.106 Google Chrome 80.0.3987.106 )
      @sololuo

      1、这不是我的,别人写的,仅分享;
      2、源码只是不更新了而已,还可以用啊,方法如上。

      1. sololuo   ( iOS 13.3.1 iOS 13.3.1 / Safari 13.0.5 Safari 13.0.5 )
        @sword

        尴尬 ,python打不开啊...闪退

        1. sword   ( Windows 10 x64 Edition Windows 10 x64 Edition / Google Chrome 80.0.3987.106 Google Chrome 80.0.3987.106 )
          @sololuo

          额,报错了吧,或者用exe版本?

  17. 奶爸建网站笔记   ( Windows 10 x64 Edition Windows 10 x64 Edition / Google Chrome 79.0.3945.130 Google Chrome 79.0.3945.130 )

    不出门,口罩消耗还行,留给有需要的去抢。

    1. TinyF3   ( Windows 10 x64 Edition Windows 10 x64 Edition / Google Chrome 80.0.3987.132 Google Chrome 80.0.3987.132 )
      @奶爸建网站笔记

      各位大侠,现在V3用不了,如何才能用啊,家里小孩要开学了,得用口罩