Giter VIP home page Giter VIP logo

jdbuyer's Introduction


Logo

Jd小猪手

一款支持京东自动下单的小工具。

1 关于项目

欢迎使用京东小猪手,当您在京东上想要购买的商品无货时,小助手可以帮助您全天候监听商品库存,并在有货时第一时间自动尝试下单,且下单成功后支持微信通知触达。

📢注意:由于货源有限,监听到货源后并不能保证一定下单成功,只能保证让你和全国黄牛站在同一起跑线上,剩下的交给奇迹。

1.1 ChangeList

  • 2022-10-29
  1. 新增预售商品定金下单模式
  2. 切换库存查询方式(注意控制速度)

2 食用教程

目前该项目支持两种 Shell 脚本GUI 图形界面 两种运行模式,目前 Shell 模式支持日志和微信通知,但还需一些额外配置,可根据自身条件选择启动方式。

2.1 Shell 脚本

  1. 安装运行环境
  1. 安装第三方库
pip install -r requirements.txt
# or 
pip3 install -r requirements.txt
  1. 修改配置

进入项目目录,找到 config.ini 文件,按照其中说明修改对于配置。

  1. 运行脚本

修改项目主文件 JdBuyer.py 最后部分中 skuIdareaId其余参数字请按注释自行选择修改

然后运行程序:

python JdBuyer.py
# or
python JdBuyer.py

2.2 GUI 图形界面

目前可支持 windows 和 macos,请到 release 下载对于文件:

  • windwos 下载 JdBuyerApp.zip,解压后双击运行其中可执行文件即可;

  • macos 下载 JdBuyerApp.app,下载后直接双击运行即可。

1. 如何配置

运行程序后,可以看到一共有一下五个配置:

参数名称 是否必填 说明
商品SKU 京东商品详情页链接中可以找到,
https://item.jd.com/100015253061.html
地区ID 下单地址所在的地区,
可以在工程 area_id 文件夹中找到
购买商品数量 默认1
库存查询间隔 监听库存的时间间隔,默认3秒
支付密码 如需使用虚拟资产,如京豆、E卡等

注:所有配置均只会保存本地。

2. 如何运行

当完成以上配置后,点击【开始】按钮即可,如果当前是未登陆状态,会自动弹出登陆二维码等待你打开京东APP扫码登录,登陆成功后会自动开始执行任务。

注:如长时间未登录提示二维码过期,点击【结束】按钮,重新【开始】即可。

2.3 视频教程

B站传送门,记得一键三连哦!

3 Todo

  • 支持扫码登陆
  • 登陆状态保活
  • 开发图形界面

免责声明

本项目所用资源均源自网络,如有侵犯您的权益,请来信告知,将立即予以处理。

任何以任何方式查看此项目的人或直接或间接使用该项目任何使用者都应仔细阅读此声明。一旦使用并复制了任何相关脚本或Script项目的规则,则视为您已接受此免责声明。

您必须在下载后的24小时内从计算机或手机中完全删除以上内容。

jdbuyer's People

Contributors

zas023 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jdbuyer's Issues

登录成功后报错

Traceback (most recent call last):
File "C:\Program Files\Python39\lib\site-packages\requests\models.py", line 972, in json
return complexjson.loads(self.text, **kwargs)
File "C:\Program Files\Python39\lib\json_init_.py", line 346, in loads
return _default_decoder.decode(s)
File "C:\Program Files\Python39\lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\Program Files\Python39\lib\json\decoder.py", line 353, in raw_decode
obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "E:\Learn\JDBuyBuy\JdBuyer_KangYuan_JiuAn\JdBuyer.py", line 115, in
buyer.buyItemInStock(skuId, areaId, skuNum, stockInterval,
File "E:\Learn\JDBuyBuy\JdBuyer_KangYuan_JiuAn\JdBuyer.py", line 75, in buyItemInStock
self.session.fetchItemDetail(skuId)
File "E:\Learn\JDBuyBuy\JdBuyer_KangYuan_JiuAn\JdSession.py", line 169, in fetchItemDetail
resp = self.getItemDetail(skuId).json()
File "C:\Program Files\Python39\lib\site-packages\requests\models.py", line 976, in json
raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1)

请求不了登录二维码

requests.exceptions.ProxyError: HTTPSConnectionPool(host='qr.m.jd.com', port=443): Max retries exceeded with url: /show?appid=133&size=147&t=1672369101367 (Caused by ProxyError('Cannot conn
ect to proxy.', OSError(0, 'Error')))

说是请求次数频繁?

无法登陆账号

扫码后仍显示“请使用京东扫码登录”,而不是库存刷新时间及结果

requests.exceptions.JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1)

PS D:\workplace\JdBuyer-main> python JdBuyer.py
2022-10-30 18:14:12,605 INFO: 登录成功
Traceback (most recent call last):
File "D:\javaDev\PythonDev\lib\site-packages\requests\models.py", line 972, in json
return complexjson.loads(self.text, **kwargs)
File "D:\javaDev\PythonDev\lib\json_init_.py", line 357, in loads
return _default_decoder.decode(s)
File "D:\javaDev\PythonDev\lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "D:\javaDev\PythonDev\lib\json\decoder.py", line 353, in raw_decode
obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "JdBuyer.py", line 115, in
buyer.buyItemInStock(skuId, areaId, skuNum, stockInterval,
File "JdBuyer.py", line 75, in buyItemInStock
self.session.fetchItemDetail(skuId)
File "D:\workplace\JdBuyer-main\JdSession.py", line 169, in fetchItemDetail
resp = self.getItemDetail(skuId).json()
File "D:\javaDev\PythonDev\lib\site-packages\requests\models.py", line 976, in json
raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1)

点击开始无反应

image
这里不管是使用默认sku和areaId,还是自己配置的数据,点击开始都无反应。win10环境下

命令行模式报错

具体错误内容如下

Traceback (most recent call last):
  File "D:\Python\lib\site-packages\urllib3\connectionpool.py", line 696, in urlopen
    self._prepare_proxy(conn)
  File "D:\Python\lib\site-packages\urllib3\connectionpool.py", line 964, in _prepare_proxy
    conn.connect()
  File "D:\Python\lib\site-packages\urllib3\connection.py", line 359, in connect
    conn = self._connect_tls_proxy(hostname, conn)
  File "D:\Python\lib\site-packages\urllib3\connection.py", line 496, in _connect_tls_proxy
    return ssl_wrap_socket(
  File "D:\Python\lib\site-packages\urllib3\util\ssl_.py", line 432, in ssl_wrap_socket
    ssl_sock = _ssl_wrap_socket_impl(sock, context, tls_in_tls)
  File "D:\Python\lib\site-packages\urllib3\util\ssl_.py", line 474, in _ssl_wrap_socket_impl
    return ssl_context.wrap_socket(sock)
  File "D:\Python\lib\ssl.py", line 500, in wrap_socket
    return self.sslsocket_class._create(
  File "D:\Python\lib\ssl.py", line 1040, in _create
    self.do_handshake()
  File "D:\Python\lib\ssl.py", line 1309, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:1123)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\Python\lib\site-packages\requests\adapters.py", line 489, in send
    resp = conn.urlopen(
  File "D:\Python\lib\site-packages\urllib3\connectionpool.py", line 755, in urlopen
    retries = retries.increment(
  File "D:\Python\lib\site-packages\urllib3\util\retry.py", line 573, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='qr.m.jd.com', port=443): Max retries exceeded with url: /show?appid=133&size=147&t=1671777008328 (Caused by SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:1123)')))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\下载\JdBuyer-main\JdBuyer.py", line 114, in <module>
    buyer.loginByQrCode()
  File "D:\下载\JdBuyer-main\JdBuyer.py", line 36, in loginByQrCode
    qrCode = self.session.getQRcode()
  File "D:\下载\JdBuyer-main\JdSession.py", line 100, in getQRcode
    resp = self.sess.get(url=url, headers=headers, params=payload)
  File "D:\Python\lib\site-packages\requests\sessions.py", line 600, in get
    return self.request("GET", url, **kwargs)
  File "D:\Python\lib\site-packages\requests\sessions.py", line 587, in request
    resp = self.send(prep, **send_kwargs)
  File "D:\Python\lib\site-packages\requests\sessions.py", line 701, in send
    r = adapter.send(request, **kwargs)
  File "D:\Python\lib\site-packages\requests\adapters.py", line 563, in send
    raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='qr.m.jd.com', port=443): Max retries exceeded with url: /show?appid=133&size=147&t=1671777008328 (Caused by SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:1123)')))

image
image
image

查询库存显示异常

ERROR: ('查询 %s 库存信息发生异常, resp: %s, exception: %s', '10033592167263', 'jQuery6485269({})', AttributeError("'NoneType' object has no attribute 'get'"))

ERROR: 购物车取消勾选失败

2022-12-16 14:21:23,154 INFO: 100043960941 满足下单条件,开始执行
2022-12-16 14:21:23,202 ERROR: 购物车取消勾选失败

[suggestion] 推送登录二维码到 Server 酱进行状态保活

首先,伸手党非常感谢作者开源这个项目,也是一样准备抢台富士相机
关于登录状态的问题,以前玩过京东 web 端相关的API,很长时间,京东 web 的 session 可以维持很久,可以用于领取一些奖励或者保价。后来京东那边做了技术调整,京东 web 的 session 基本 24 小时不到就会失效,需要频繁登录的监听程序直接废了

我这边有一个想法,碍于对 Python 不熟悉,无法发起 PR,能否在 testSession false 的时候,重新获取登录二维码,并且通过某些推送渠道,将二维码图片通知给监听的人,然后实现手工再登录,完成变相的保活。

以上。

不能用了吧?

F:\jd\JdBuyer-main>python JdBuyer.py
2022-12-15 22:35:39,021 INFO: 登录成功
Traceback (most recent call last):
File "F:\jd\JdBuyer-main\JdBuyer.py", line 115, in
buyer.buyItemInStock(skuId, areaId, skuNum, stockInterval,
File "F:\jd\JdBuyer-main\JdBuyer.py", line 75, in buyItemInStock
self.session.fetchItemDetail(skuId)
File "F:\jd\JdBuyer-main\JdSession.py", line 169, in fetchItemDetail
resp = self.getItemDetail(skuId).json()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\YanYonghang\AppData\Local\Programs\Python\Python311\Lib\site-packages\requests\models.py", line 898, in json
return complexjson.loads(self.text, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\YanYonghang\AppData\Local\Programs\Python\Python311\Lib\json_init_.py", line 346, in loads
return _default_decoder.decode(s)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\YanYonghang\AppData\Local\Programs\Python\Python311\Lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\YanYonghang\AppData\Local\Programs\Python\Python311\Lib\json\decoder.py", line 353, in raw_decode
obj, end = self.scan_once(s, idx)
^^^^^^^^^^^^^^^^^^^^^^
json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1)

正常运行中突然报错,这个是啥情况

2022-12-15 09:03:16,482 INFO: 登录成功
Traceback (most recent call last):
File "C:\Users~\AppData\Local\Programs\Python\Python310\lib\site-packages\requests\models.py", line 971, in json
return complexjson.loads(self.text, **kwargs)
File "C:\Users~\AppData\Local\Programs\Python\Python310\lib\json_init_.py", line 346, in loads
return _default_decoder.decode(s)
File "C:\Users~\AppData\Local\Programs\Python\Python310\lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\Users~\AppData\Local\Programs\Python\Python310\lib\json\decoder.py", line 353, in raw_decode
obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\temp\JdBuyer-main\JdBuyer.py", line 115, in
buyer.buyItemInStock(skuId, areaId, skuNum, stockInterval,
File "C:\temp\JdBuyer-main\JdBuyer.py", line 76, in buyItemInStock
self.session.fetchItemDetail(skuId)
File "C:\temp\JdBuyer-main\JdSession.py", line 169, in fetchItemDetail
resp = self.getItemDetail(skuId).json()
File "C:\Users~\AppData\Local\Programs\Python\Python310\lib\site-packages\requests\models.py", line 975, in json
raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1)

尝试打印getItemDetail方法中调用京东接口的返回值,发现是{'code': 200,'limit': 1}

抢购不会以最低的价格

目前有一些产品需要使用系统带的优惠卷,会便宜很多钱。

目前不会自动使用优惠卷,只是使用商品默认价格进行抢购。

感谢大佬,拿你的代码魔改了一点点,抢到了4080公版。

主要优化了扫码那个配置,默认的我二维码我扫了总登录不上,我改了一下格式从png改成了jpg,然后加了白色边框,就可以扫码了。
定时器那个用的第三方包,写的那个while循环定时器感觉不太好用。
然后加入了停止时间配置。
目前只有命令行版,没有弄界面,有需要的,可以说一声,等我有空了再弄。
https://github.com/Tlntin/JdBuyer

Bug Report

image
Python 3.9.11运行时寄了
image
这理论上应该要匹配才对&&为啥作者大大能直接正常生成出运行文件orz

抢购无效

最近在抢iphone14,设置好定时抢购开始执行脚本,一直显示未满足抢购条件,到达抢购时间也是一样

Bug

GUI无法显示登录界面

清空购物车显示成功实际上并没有清空

清空购物车显示成功实际上并没有清空,会导致如果这次提交订单没有成功的话,下次再检测到有货的话,下次再加一次购物车就是两件商品一起下单了,麻烦您看一下

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.