Code Monkey home page Code Monkey logo

jdbuymask's Introduction


因官方善意通知,本仓库和大家88了

仅记录一段疫情下口罩的匮乏,程序员使用技术相互帮助

后续有积极的爬虫工具需求也可以和作者私信询问

江湖再见


祝大家早点买到口罩

image image

避免抢购,程序自动一次只买一件

V2版本(已不更新)

请在configDemo.ini 加入商品id、地区id、cookie等参数 区分下单模式(默认2正常模式)

注意--极速模式默认清空购物车

正常模式下单流程(1.7秒左右)

  • 检测有货
  • 检测下柜
  • 加入购物车
  • 查看购物车
  • 下单

极速模式下单流程(1.4秒左右)

  • 检测有货
  • 加入购物车
  • 下单

V3版本(下单更快)(已不更新)

下单更快,但只能扫描单独一件商品

在配置文件configDemo.ini中,填写[V3]下面的skuid

注意--V3版本默认清空购物车

V3版本下单流程(1秒左右)

  • 提前加入购物车
  • 检测有货
  • 下单

温馨提示

  • 在京东购物车结算页面设置发票为电子普通发票-个人设置支付方式为在线支付
  • 地区id不知道如何获取的,请使用AreaTool.py获取

版本

  • python3

功能

  • 检查登录
  • 确认是否有货
  • 有货自动下单
  • 邮件、微信通知

更新记录

  • 【2020.02.12】更新exe版本,代码暂不更新了。
  • 【2020.02.10】每10分钟自动读取一次配置修改商品不需要退出重开,优化有货,不支持省份出售情况,优化日志,加快查询频率。
  • 【2020.02.09】部分下单需要验证码识别问题,部分bug优化。
  • 【2020.02.08】V2版本,区分下单模式,config中错别字,bug修复。
  • 【2020.02.07】V3版本,减少提交订单的请求量,总而言之就是更快(只能监控一件商品)。
  • 【2020.02.07】无货等情况下单失败不重试。
  • 【2020.02.07】新增微信通知(http://sc.ftqq.com/3.version 查看sc_key),bug修复。
  • 【2020.02.06】V2版本,刷新更快更频繁,通过配置文件添加商品和地区id。
  • 【2020.02.06】提交失败之后会继续不会暂停。
  • 【2020.02.06】购物车有套装商品导致解析skuid错误。
  • 【2020.02.05】商品有货,但是该商品已下柜,提交会报错,对部分代码进行了优化。

反馈问题

  • 如果有红包先花掉再开脚本,不然可能需要支付密码
  • 出现下单地址不是默认地址的,在线下一单,取getOrderInfo.action链接的cookie
  • CMD界面卡住、关闭CMD的快速编辑模式就行了

jdbuymask's People

Contributors

cycz 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jdbuymask's Issues

下架商品偶尔有提示

最新V2版本,下架商品99%提示无货,但是偶尔会提示该商品有货,但是下架了。其余情况都是显示无货。

可耻,shame on you

程序员需要个屁的口罩。。。。

真正需要口罩的人,估计都是不懂爬虫的。。。

技术作恶!!!

bug:重复获取同一款口罩id

Snipaste_2020-02-07_18-14-19
2020-02-07 18:15:27,230 INFO: 登录账号名称
2020-02-07 18:15:27,230 INFO: 第1次
2020-02-07 18:15:27,306 INFO: [16]个skuid口罩无货
2020-02-07 18:15:28,608 INFO: 第2次
2020-02-07 18:15:28,679 INFO: [16]个skuid口罩无货
2020-02-07 18:15:29,481 INFO: 第3次
2020-02-07 18:15:29,844 INFO: [16]个skuid口罩无货
2020-02-07 18:15:31,045 INFO: 第4次
2020-02-07 18:15:31,404 INFO: [16]个skuid口罩无货
2020-02-07 18:15:32,605 INFO: 第5次
2020-02-07 18:15:32,697 INFO: [16]个skuid口罩无货
2020-02-07 18:15:33,798 INFO: 第6次
2020-02-07 18:15:33,877 INFO: [16]个skuid口罩无货
2020-02-07 18:15:34,777 INFO: 第7次
2020-02-07 18:15:34,840 INFO: [16]个skuid口罩无货

Centos7下简单部署方法

感谢Cycz的代码,我已经将其放在树莓派上运行并静待佳音。
以下提供Centos7下的安装方法,除了config.ini需要更改之外,其他应该都能使用了。以下命令复制粘贴应该就好,参数部分参考Cycz的configDemo.ini内说明:

1 安装部分
yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
yum -y install nohup vim python36 python36-pip git
cd /home/
git clone https://github.com/cycz/jdBuyMask.git
cd jdBuyMask
pip3 install -r ./requirements.txt
cp configDemo.ini config.ini
sed -i 's/configDemo/config/ ' config/config.py

2 编辑config.ini
#填写自己的skuid,area,cookie等信息
vim config.ini

3 启动,根基需要使用各版本
nohup python3 ./jdBuyMask_V2.py &

目前下订单时遇到的bug

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "jdBuyMask_V2.py", line 493, in
sendMail(mail, skuidUrl, False)
File "C:\Users.....\Desktop\jdBuyMask-master\jdemail\jdEmail.py", line 35, in sendMail
server = smtplib.SMTP_SSL(host=smtp_server)
File "C:\Users.....\AppData\Local\Programs\Python\Python37\lib\smtplib.py", line 1031, in init
source_address)
File "C:\Users.....\AppData\Local\Programs\Python\Python37\lib\smtplib.py", line 251, in init
(code, msg) = self.connect(host, port)
File "C:\Users.....\AppData\Local\Programs\Python\Python37\lib\smtplib.py", line 336, in connect
self.sock = self._get_socket(host, port, self.timeout)
File "C:\Users.....\AppData\Local\Programs\Python\Python37\lib\smtplib.py", line 1037, in _get_socket
self.source_address)
File "C:\Users.....\AppData\Local\Programs\Python\Python37\lib\socket.py", line 716, in create_connection
sock.connect(sa)
KeyboardInterrupt

为啥会提示字典错误

Traceback (most recent call last):
File "C:/Users/95/Desktop//jdBuyMask-master/jdBuyMask.py", line 504, in
if buyMask(skuId):
File "C:/Users/95/Desktop//jdBuyMask-master/jdBuyMask.py", line 455, in buyMask
cart = cart_detail()
File "C:/Users/95/Desktop//jdBuyMask-master/jdBuyMask.py", line 221, in cart_detail
sku_id = item['sku_id'] # 商品id
File "C:\Users\995995\Anaconda3\lib\site-packages\bs4\element.py", line 997, in getitem
return self.attrs[key]
KeyError: 'sku_id'

添加购物车失败

2020-02-05 13:01:56,324 ERROR: 4642656 添加到购物车失败
2020-02-05 13:01:57,016 ERROR: 下单页面数据解析异常:list index out of range
Traceback (most recent call last):
File "./jdBuyMask.py", line 493, in
if buyMask(skuId):
File "./jdBuyMask.py", line 459, in buyMask
risk_control = get_checkout_page_detail()
File "./jdBuyMask.py", line 345, in get_checkout_page_detail
return risk_control
UnboundLocalError: local variable 'risk_control' referenced before assignment

一直往微信发送成功信息,但其实并没有下单成功

2020-02-07 16:59:24,568 INFO: 第1次
2020-02-07 16:59:25,133 INFO: [35]个skuid口罩无货
2020-02-07 16:59:25,516 INFO: Message sent successfully [text: 京东商品监控, desp: https://item.jd.com/ 类型口罩,已经下单了。24小时内付款 [2020-02-07 16:59:25.134857]]
2020-02-07 16:59:26,018 INFO: 第2次
2020-02-07 16:59:26,561 INFO: [35]个skuid口罩无货
2020-02-07 16:59:26,881 INFO: Message sent successfully [text: 京东商品监控, desp: https://item.jd.com/ 类型口罩,已经下单了。24小时内付款 [2020-02-07 16:59:26.562301]]
2020-02-07 16:59:27,682 INFO: 第3次
2020-02-07 16:59:27,977 INFO: [35]个skuid口罩无货
2020-02-07 16:59:28,274 INFO: Message sent successfully [text: 京东商品监控, desp: https://item.jd.com/ 类型口罩,已经下单了。24小时内付款 [2020-02-07 16:59:27.977558]]
2020-02-07 16:59:29,075 INFO: 第4次
2020-02-07 16:59:29,327 INFO: [35]个skuid口罩无货
2020-02-07 16:59:29,664 INFO: Message sent successfully [text: 京东商品监控, desp: https://item.jd.com/ 类型口罩,已经下单了。24小时内付款 [2020-02-07 16:59:29.328333]]

configDemo.ini文件中的注释问题

configDemo.ini中的注释:line 27【# v3版本的skuid,最多写一件】,此处看后面的过程的话应该是最少写一件而不是最多写一件吧。

汇报一下提交订单时遇到的错误

win10 x64
Python 3.6.8
上海电信100m
使用v2版本里的 jdBuyMask.py文件

jdBuyMask_V2.py 因为逗号的问题,程序一直没跑起来.

实在不会代码,附上遇到的一些小错误,仅供参考 希望能帮到作者.
我承认我有赌的成分 我把订单数量改成了2个........ 有几个错误是我自找的......

2020-02-07 04:29:41,285 INFO: [65437208345]类型口罩有货啦!马上下单
2020-02-07 04:29:41,286 INFO: 第[1/3]次尝试提交订单
2020-02-07 04:29:41,636 INFO: 购物车信息:{}
2020-02-07 04:29:41,832 INFO: 65437208345 已成功加入购物车
2020-02-07 04:29:42,679 INFO: 下单信息 这里是我的地址 '480.00', 'items': []}
2020-02-07 04:29:42,747 INFO: 订单提交失败, 错误码:0, 返回信息:验证码不正确,请重新填写(下单商品可能为第三方商品,将切换为普通发票进行尝试)
2020-02-07 04:29:42,747 INFO: {'overSea': False, 'orderXml': None, 'cartXml': None, 'noStockSkuIds': '', 'reqInfo': None, 'hasJxj': False, 'addedServiceList': None, 'sign': None, 'pin': None, 'needCheckCode': True, 'success': False, 'resultCode': 0, 'orderId': 0, 'submitSkuNum': 0, 'deductMoneyFlag': 0, 'goJumpOrderCenter': False, 'payInfo': None, 'scaleSkuInfoListVO': None, 'purchaseSkuInfoListVO': None, 'noSupportHomeServiceSkuList': None, 'msgMobile': None, 'addressVO': None, 'msgUuid': None, 'message': '验证码不正确,请重新填写'}
2020-02-07 04:29:42,764 INFO: 休息3s

2020-02-07 06:37:18,583 INFO: [100005779995]类型口罩有货啦!马上下单
2020-02-07 06:37:18,583 INFO: 第[1/3]次尝试提交订单
2020-02-07 06:37:18,934 INFO: 购物车信息:{}
2020-02-07 06:37:19,125 INFO: 100005779995 已成功加入购物车
2020-02-07 06:37:20,035 INFO: 下单信息这里是我的地址: '238.00', 'items': []}
2020-02-07 06:37:20,159 INFO: 订单提交失败, 错误码:600158, 返回信息:百舸 口罩30只防尘防护 KN95级别 过滤式耳带折叠式带呼吸阀 防雾霾 防花粉 活性炭装新老款随机发货商品无货
2020-02-07 06:37:20,160 INFO: {'overSea': False, 'orderXml': None, 'cartXml': None, 'noStockSkuIds': '100005779995', 'reqInfo': None, 'hasJxj': False, 'addedServiceList': None, 'sign': None, 'pin': '364114', 'needCheckCode': False, 'success': False, 'resultCode': 600158, 'orderId': 0, 'submitSkuNum': 0, 'deductMoneyFlag': 0, 'goJumpOrderCenter': False, 'payInfo': None, 'scaleSkuInfoListVO': None, 'purchaseSkuInfoListVO': None, 'noSupportHomeServiceSkuList': None, 'msgMobile': None, 'addressVO': {'pin': '364114', 'checkLevel': 0, 'appId': None, 'appSelfPickAddress': 0, 'associatePickId': 0, 'associateAddressId': 0, 'encryptText': None, 'certNum': None, 'addressDefaultCancel': None, 'updateTime': None, 'lastOrderAddress': False, 'sendMq': 0, 'addressMapperInfoVO': None, 'used': False, 'oldAddress': False, 'mapping': False, 'fullAddress': '我的地址', 'freePay': False, 'addressDefault': False, 'selfPickAddressShuntFlag': 0, 'pickId': 0, 'pickName': None, 'pickVOselected': False, 'mapUrl': None, 'branchId': 0, 'canSelected': False, 'siteType': 0, 'helpMessage': None, 'tipInfo': None, 'cabinetAvailable': True, 'limitKeyword': 0, 'specialRemark': None, 'siteProvinceId': 0, 'siteCityId': 0, 'siteCountyId': 0, 'siteTownId': 0, 'skuSupported': False, 'addressSupported': 0, 'isCod': 0, 'consigneeName': None, 'pickVOname': None, 'shipmentType': 0, 'retTag': 0, 'tagSource': 0, 'userDefinedTag': None, 'newProvinceId': 0, 'newCityId': 0, 'newCountyId': 0, 'newTownId': 0, 'newProvinceName': None, 'newCityName': None, 'newCountyName': None, 'newTownName': None, 'optimizePickID': 0, 'pickType': 0, 'dataSign': 0, 'overseas': 0, 'areaName': '', 'provinceId': 2, 'cityId': 2833, 'countyId': 51952, 'townId': 0, 'paymentId': 0, 'showChangeJingAddressFlag': None, 'selected': False, 'addressDetail': '我的地址', 'mobile': '我的手机号', 'idCard': '', 'phone': None, 'email': None, 'selfPickOptimize': 0, 'consigneeId': 0, 'selfPickMobile': None, 'selfPickPhone': None, 'selectedAddressType': 0, 'addressType': 0, 'provinceName': None, 'cityName': None, 'countyName': None, 'townName': None, 'addressName': None, 'areaCode': None, 'nameCode': None, 'postCode': None, 'giftSenderConsigneeName': None, 'giftSenderConsigneeMobile': None, 'gcLat': 0.0, 'gcLng': 0.0, 'coord_type': 0, 'longitude': 0.0, 'latitude': 0.0, 'address': None, 'name': '我的名字', 'message': None, 'id': 0}, 'msgUuid': None, 'message': '百舸 口罩30只防尘防护 KN95级别 过滤式耳带折叠式带呼吸阀 防雾霾 防花粉 活性炭装新老款随机发货商品无货'}
2020-02-07 06:37:20,181 INFO: 休息3s
2020-02-07 06:37:23,182 INFO: 执行结束,提交订单失败!
2020-02-07 06:37:25,980 INFO: 第1341次

2020-02-07 09:45:06,490 INFO: [34204543855]类型口罩有货啦!马上下单
2020-02-07 09:45:06,491 INFO: 第[1/3]次尝试提交订单
2020-02-07 09:45:06,949 INFO: 购物车信息:{'100002690350': {'name': '3M 9002V带阀防护口罩 KN90折叠头带式防雾霾防沙尘 25只/盒独立装 两款包装随机发货', 'verder_id': '8888', 'count': 2, 'unit_price': '151.00', 'total_price': '302.00', 'is_selected': False, 'p_type': '1', 'target_id': 0, 'promo_id': 0}, '100009441994': {'name': '3M口罩自营防尘 防雾霾 PM2.5防工业粉尘 男女款滤棉防异味烟雾花粉 耳戴式9501V 25只/盒', 'verder_id': '8888', 'count': 2, 'unit_price': '158.00', 'total_price': '316.00', 'is_selected': False, 'p_type': '1', 'target_id': 0, 'promo_id': 0}, '100005779995': {'name': '百舸 口罩30只防尘防护 KN95级别 过滤式耳带折叠式带呼吸阀 防雾霾 防花粉 活性炭装新老款随机发货', 'verder_id': '8888', 'count': 2, 'unit_price': '119.00', 'total_price': '238.00', 'is_selected': False, 'p_type': '1', 'target_id': 0, 'promo_id': 0}}
2020-02-07 09:45:07,112 INFO: 34204543855 已成功加入购物车
2020-02-07 09:45:07,954 INFO: 下单信息:{'address': '上海 青浦区 赵巷镇 沪青平公路1638弄69号', 'receiver': '马腾飞 176****6266', 'total_price': '150.00', 'items': []}
2020-02-07 09:45:08,026 INFO: 订单提交失败, 错误码:60040, 返回信息:抱歉,商品'南丁口罩一次性男女一次性口罩加厚款防尘口罩一次性单个装防雾霾口罩男潮款冬季防护口罩防细菌 成人四层加棉耳挂式15只/盒'促销期间限购1件,您本次购买件数超过了限购件数,请回到购物车修改商品数量后再重新下单,谢谢
2020-02-07 09:45:08,027 INFO: {'addedServiceList': None, 'overSea': False, 'orderXml': None, 'cartXml': None, 'noStockSkuIds': '', 'reqInfo': None, 'hasJxj': False, 'sign': None, 'pin': '364114', 'needCheckCode': False, 'success': False, 'resultCode': 60040, 'orderId': 0, 'submitSkuNum': 0, 'deductMoneyFlag': 0, 'goJumpOrderCenter': False, 'payInfo': None, 'scaleSkuInfoListVO': None, 'purchaseSkuInfoListVO': None, 'noSupportHomeServiceSkuList': None, 'msgMobile': None, 'addressVO': None, 'msgUuid': None, 'message': "抱歉,商品'南丁口罩一次性男女一次性口罩加厚款防尘口罩一次性单个装防雾霾口罩男潮款冬季防护口罩防细菌 成人四层加棉耳挂式15只/盒'促销期间限购1件,您本次购买件数超过了限购件数,请回到购物车修改商品数量后再重新下单,谢谢"}
2020-02-07 09:45:08,036 INFO: 休息3s
2020-02-07 09:45:11,037 INFO: 执行结束,提交订单失败!

2020-02-07 07:59:19,261 INFO: [100009441994]类型口罩有货啦!马上下单
2020-02-07 07:59:19,261 INFO: 第[1/3]次尝试提交订单
2020-02-07 07:59:19,680 INFO: 购物车信息:{'100005779995': {'name': '百舸 口罩30只防尘防护 KN95级别 过滤式耳带折叠式带呼吸阀 防雾霾 防花粉 活性炭装新老款随机发货', 'verder_id': '8888', 'count': 2, 'unit_price': '119.00', 'total_price': '238.00', 'is_selected': False, 'p_type': '1', 'target_id': 0, 'promo_id': 0}}
2020-02-07 07:59:19,868 INFO: 100009441994 已成功加入购物车
2020-02-07 07:59:20,784 INFO: 下单信息:{'address': '上海 青浦区 赵巷镇 我的地址', 'receiver': '我的名字 176****6266', 'total_price': '316.00', 'items': []}
2020-02-07 07:59:20,897 INFO: 订单提交失败, 错误码:600158, 返回信息:3M口罩自营防尘 防雾霾 PM2.5防工业粉尘 男女款滤棉防异味烟雾花粉 耳戴式9501V 25只/盒商品无货
2020-02-07 07:59:20,898 INFO: {'cartXml': None, 'noStockSkuIds': '100009441994', 'reqInfo': None, 'overSea': False, 'orderXml': None, 'hasJxj': False, 'addedServiceList': None, 'sign': None, 'pin': '364114', 'needCheckCode': False, 'success': False, 'resultCode': 600158, 'orderId': 0, 'submitSkuNum': 0, 'deductMoneyFlag': 0, 'goJumpOrderCenter': False, 'payInfo': None, 'scaleSkuInfoListVO': None, 'purchaseSkuInfoListVO': None, 'noSupportHomeServiceSkuList': None, 'msgMobile': None, 'addressVO': {'pin': '364114', 'used': False, 'oldAddress': False, 'mapping': False, 'checkLevel': 0, 'appId': None, 'siteCityId': 0, 'siteCountyId': 0, 'siteTownId': 0, 'skuSupported': False, 'addressSupported': 0, 'isCod': 0, 'consigneeName': None, 'pickVOname': None, 'shipmentType': 0, 'retTag': 0, 'tagSource': 0, 'userDefinedTag': None, 'newProvinceId': 0, 'newCityId': 0, 'newCountyId': 0, 'newTownId': 0, 'newProvinceName': None, 'newCityName': None, 'newCountyName': None, 'newTownName': None, 'optimizePickID': 0, 'pickType': 0, 'dataSign': 0, 'overseas': 0, 'appSelfPickAddress': 0, 'associatePickId': 0, 'associateAddressId': 0, 'encryptText': None, 'certNum': None, 'addressDefaultCancel': None, 'updateTime': None, 'lastOrderAddress': False, 'sendMq': 0, 'addressMapperInfoVO': None, 'areaName': '', 'provinceId': 2, 'cityId': 2833, 'countyId': 51952, 'townId': 0, 'paymentId': 0, 'showChangeJingAddressFlag': None, 'selected': False, 'addressDetail': '我的地址', 'mobile': '我的手机号', 'idCard': '', 'phone': None, 'email': None, 'selfPickOptimize': 0, 'consigneeId': 0, 'selfPickMobile': None, 'selfPickPhone': None, 'selectedAddressType': 0, 'addressType': 0, 'provinceName': None, 'cityName': None, 'countyName': None, 'townName': None, 'addressName': None, 'areaCode': None, 'nameCode': None, 'postCode': None, 'giftSenderConsigneeName': None, 'giftSenderConsigneeMobile': None, 'gcLat': 0.0, 'gcLng': 0.0, 'coord_type': 0, 'longitude': 0.0, 'latitude': 0.0, 'fullAddress': '上海青浦区赵巷镇我的地址', 'freePay': False, 'addressDefault': False, 'selfPickAddressShuntFlag': 0, 'pickId': 0, 'pickName': None, 'pickVOselected': False, 'mapUrl': None, 'branchId': 0, 'canSelected': False, 'siteType': 0, 'helpMessage': None, 'tipInfo': None, 'cabinetAvailable': True, 'limitKeyword': 0, 'specialRemark': None, 'siteProvinceId': 0, 'address': None, 'name': '我的名字', 'message': None, 'id': 0}, 'msgUuid': None, 'message': '3M口罩自营防尘 防雾霾 PM2.5防工业粉尘 男女款滤棉防异味烟雾花粉 耳戴式9501V 25只/盒商品无货'}
2020-02-07 07:59:20,914 INFO: 休息3s
2020-02-07 07:59:23,915 INFO: 执行结束,提交订单失败!

2020-02-07 09:45:06,490 INFO: [34204543855]类型口罩有货啦!马上下单
2020-02-07 09:45:06,491 INFO: 第[1/3]次尝试提交订单
2020-02-07 09:45:06,949 INFO: 购物车信息:{'100002690350': {'name': '3M 9002V带阀防护口罩 KN90折叠头带式防雾霾防沙尘 25只/盒独立装 两款包装随机发货', 'verder_id': '8888', 'count': 2, 'unit_price': '151.00', 'total_price': '302.00', 'is_selected': False, 'p_type': '1', 'target_id': 0, 'promo_id': 0}, '100009441994': {'name': '3M口罩自营防尘 防雾霾 PM2.5防工业粉尘 男女款滤棉防异味烟雾花粉 耳戴式9501V 25只/盒', 'verder_id': '8888', 'count': 2, 'unit_price': '158.00', 'total_price': '316.00', 'is_selected': False, 'p_type': '1', 'target_id': 0, 'promo_id': 0}, '100005779995': {'name': '百舸 口罩30只防尘防护 KN95级别 过滤式耳带折叠式带呼吸阀 防雾霾 防花粉 活性炭装新老款随机发货', 'verder_id': '8888', 'count': 2, 'unit_price': '119.00', 'total_price': '238.00', 'is_selected': False, 'p_type': '1', 'target_id': 0, 'promo_id': 0}}
2020-02-07 09:45:07,112 INFO: 34204543855 已成功加入购物车
2020-02-07 09:45:07,954 INFO: 下单信息:{'address': '上海 青浦区 赵巷镇 我的地址', 'receiver': '我的名字 176****6266', 'total_price': '150.00', 'items': []}
2020-02-07 09:45:08,026 INFO: 订单提交失败, 错误码:60040, 返回信息:抱歉,商品'南丁口罩一次性男女一次性口罩加厚款防尘口罩一次性单个装防雾霾口罩男潮款冬季防护口罩防细菌 成人四层加棉耳挂式15只/盒'促销期间限购1件,您本次购买件数超过了限购件数,请回到购物车修改商品数量后再重新下单,谢谢

2020-02-07 09:45:08,027 INFO: {'addedServiceList': None, 'overSea': False, 'orderXml': None, 'cartXml': None, 'noStockSkuIds': '', 'reqInfo': None, 'hasJxj': False, 'sign': None, 'pin': '364114', 'needCheckCode': False, 'success': False, 'resultCode': 60040, 'orderId': 0, 'submitSkuNum': 0, 'deductMoneyFlag': 0, 'goJumpOrderCenter': False, 'payInfo': None, 'scaleSkuInfoListVO': None, 'purchaseSkuInfoListVO': None, 'noSupportHomeServiceSkuList': None, 'msgMobile': None, 'addressVO': None, 'msgUuid': None, 'message': "抱歉,商品'南丁口罩一次性男女一次性口罩加厚款防尘口罩一次性单个装防雾霾口罩男潮款冬季防护口罩防细菌 成人四层加棉耳挂式15只/盒'促销期间限购1件,您本次购买件数超过了限购件数,请回到购物车修改商品数量后再重新下单,谢谢"}
2020-02-07 09:45:08,036 INFO: 休息3s
2020-02-07 09:45:11,037 INFO: 执行结束,提交订单失败!

谢谢作者在大过年的帮大家琢磨买口罩的事情 祝愿大家有都口罩戴

运行出问题

Traceback (most recent call last):
File "C:\Users*\Desktop\Python\jdBuyMask-master_V2\jdBuyMask-master\jdBuyMask_V2.py", line 14, in
from config.config import global_config
File "C:\Users*
\Desktop\Python\jdBuyMask-master_V2\jdBuyMask-master\config\config.py", line 23, in
global_config = Config()
File "C:\Users*****\Desktop\Python\jdBuyMask-master_V2\jdBuyMask-master\config\config.py", line 10, in init
raise FileNotFoundError("No such file: config.ini")
FileNotFoundError: No such file: config.ini

请教为什么会报这样的错?我的配置哪里出了问题吗

目前的比较严重的bug

2020-02-07 20:08:36,766 INFO: [25411367334]类型口罩有货,但已下柜商品
2020-02-07 20:08:36,907 INFO: [3621679]类型口罩有货,但已下柜商品
2020-02-07 20:08:38,408 INFO: 第2次
2020-02-07 20:08:38,465 INFO: [21]个skuid口罩无货
2020-02-07 20:08:38,630 INFO: [1038227]类型口罩有货啦!马上下单
2020-02-07 20:08:38,952 INFO: 购物车信息:{'1038227': {'name': '蓝月亮 消毒水 漂白 除菌84消毒液600g/瓶 杀菌率99.999% 消毒杀菌更放心 家庭和公共场所消毒', 'verder_id': '8888', 'count': 1, 'unit_price': '7.80', 'to
tal_price': '7.80', 'is_selected': False, 'p_type': '13', 'target_id': '50072147434', 'promo_id': '50072147434'}}
2020-02-07 20:08:38,952 INFO: 1038227 已在购物车中,调整数量为 1
Status: 503, Url: http://passport.jd.com/new/login.aspx?ReturnUrl=https%3A%2F%2Ftrade.jd.com%2Fshopping%2Forder%2FgetOrderInfo.action%3Frid%3D1581077319029
2020-02-07 20:08:39,073 ERROR: 获取订单结算页信息失败
Traceback (most recent call last):
File "D:\jdBuyMask-master\message\jdEmail.py", line 37, in sendMail
server.sendmail(from_addr, to_addr, msg.as_string())
File "C:\Users\Yuxuan Zhu\AppData\Local\Programs\Python\Python37\lib\smtplib.py", line 867, in sendmail
raise SMTPSenderRefused(code, resp, from_addr)
smtplib.SMTPSenderRefused: (554, b'MI:STC 163 smtp1,GdxpCgDXIy1FUz1e59reBg--.144S2 1581077317,601,please see http://mail.163.com/help/help_spam_16.htm?ip=......&hostid=smtp1&time=1581077317', '[email protected]')

亲爱的用户,您刷新过于频繁,请稍后再试

Traceback (most recent call last):
File "/Users/xiaoliwei/PycharmProjects/jdBuyMask/jdBuyMask_V2.py", line 365, in submit_order
resp_json = json.loads(resp.text)
File "/usr/local/Cellar/python/3.7.4/Frameworks/Python.framework/Versions/3.7/lib/python3.7/json/init.py", line 348, in loads
return _default_decoder.decode(s)
File "/usr/local/Cellar/python/3.7.4/Frameworks/Python.framework/Versions/3.7/lib/python3.7/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/local/Cellar/python/3.7.4/Frameworks/Python.framework/Versions/3.7/lib/python3.7/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

把resp.text打印出来,显示是“亲爱的用户,您刷新过于频繁,请稍后再试。。。”的html页面,请问如何解决?谢谢!

请问CMD窗口代码运行过程中卡住是什么原因呢

微信图片_20200207233950

比如:
2020-02-07 21:39:53,889 INFO: 第473次
2020-02-07 21:39:54,229 INFO: [7509607,65420816727,1306182,65179783341,10653857951,100010159778,100010159774,100010159724,100010159802,100010159728,100005678825,100005294927,100009394602,1336984,100001998331,11609507800,11609510701]类型口罩无货
2020-02-07 21:39:55,631 INFO: 第474次
到这就没有了,只有 _ 一直在闪

[V3.1多商品思路提供]账号是否会被限制 SSLError 403 或者 下单延迟

requests.exceptions.SSLError: HTTPSConnectionPool(host='c0.3.cn', port=443): Max retries exceeded with url: /stocks?type=getstocks&skuIds=56963935823&area=4_50952_106_0&callback=jQuery9052360&_=1581173914389 (Caused by SSLError(SSLError("bad handshake: SysCallError(-1, 'Unexpected EOF')",),))

2020-02-08 22:58:47,832 INFO: 第3次
2020-02-08 22:58:53,338 INFO: []类型口罩无货
2020-02-08 22:58:53,338 INFO: [56963935823]类型口罩有货啦!马上下单
Status: 502, Url: http://trade.jd.com/shopping/order/getOrderInfo.action?rid=*********

2020-02-08 22:58:56,881 ERROR: 获取订单结算页信息失败

V2版本极速模式,商品ID里有下架商品,会报错

Traceback (most recent call last):
File "C:\Users\Administrator\Desktop\jdBuyMask-master\jdBuyMask-master\jdBuyMask_V2.py", line 622, in fastMode
fastModeAutoBuy(inStockSkuid)
File "C:\Users\Administrator\Desktop\jdBuyMask-master\jdBuyMask-master\jdBuyMask_V2.py", line 568, in fastModeAutoBuy
if fastModeBuyMask(skuId):
File "C:\Users\Administrator\Desktop\jdBuyMask-master\jdBuyMask-master\jdBuyMask_V2.py", line 454, in fastModeBuyMask
risk_control = get_checkout_page_detail()
File "C:\Users\Administrator\Desktop\jdBuyMask-master\jdBuyMask-master\jdBuyMask_V2.py", line 304, in get_checkout_page_detail
return risk_control
UnboundLocalError: local variable 'risk_control' referenced before assignment

为什么这个页面的口罩一直返回有货,实际无货

商品页面; https://item.jd.com/65437208345.html#crumb-wrap
url: 'https://c0.3.cn/stock?skuId=65437208345&area=22_2016_2020_7902&venderId=127922&buyNum=1&choseSuitSkuIds=&cat=9855,9858,9924&extraParam={%22originid%22:%221%22}&fqsp=0&pdpin=jd_41addb55f9ac3&pduid=158044326896194581593&ch=1&callback=jQuery6353447'
'https://c0.3.cn/stock?skuId=65466250547&area=22_2016_2020_7902&venderId=127922&buyNum=1&choseSuitSkuIds=&cat=9855,9858,9924&extraParam={%22originid%22:%221%22}&fqsp=0&pdpin=jd_41addb55f9ac3&pduid=158044326896194581593&ch=1&callback=jQuery3986267'
日志: 2020-02-06 10:04:26,085 INFO: [65437208345]类型口罩有货啦!马上下单
2020-02-06 10:04:26,086 INFO: 第[1/3]次尝试提交订单
2020-02-06 10:04:27,966 INFO: 购物车信息:{'65466250547': {'name': '代尔塔 高端可折叠舒适口罩 欧标FFP2黄阀/FFP3红阀 带呼吸阀 防尘 防雾霾口罩 黄阀(10只盒装)', 'verder_id': '127922', 'count': 1, 'unit_price': '210.00', 'total_price': '210.00', 'is_selected': False, 'p_type': '1', 'target_id': 0, 'promo_id': 0}, '65437208345': {'name': '代尔塔 高端可折叠舒适口罩 欧标FFP2黄阀/FFP3红阀 带呼吸阀 防尘 防雾霾口罩 红阀(10只盒装)', 'verder_id': '127922', 'count': 1, 'unit_price': '240.00', 'total_price': '240.00', 'is_selected': False, 'p_type': '1', 'target_id': 0, 'promo_id': 0}, '1336984': {'name': '霍尼韦尔(Honeywell)口罩 KN95 耳戴式D7002 10只/包 防尘防颗粒物男女骑行 H930系列折叠式防雾霾口罩', 'verder_id': '8888', 'count': 1, 'unit_price': '35.00', 'total_price': '35.00', 'is_selected': False, 'p_type': '1', 'target_id': 0, 'promo_id': 0}}
2020-02-06 10:04:27,966 INFO: 65437208345 已在购物车中,调整数量为 1
2020-02-06 10:04:34,695 INFO: 下单信息:{'address': '四川 广安市 广安区 xxxxx xxxx', 'receiver': 'xxxx 199****5375', 'total_price': '235.00', 'items': []}
2020-02-06 10:04:34,896 INFO: 订单提交失败, 错误码:600158, 返回信息:代尔塔 高端可折叠舒适口罩 欧标FFP2黄阀/FFP3红阀 带呼吸阀 防尘 防雾霾口罩 红阀(10只盒装)商品无货
2020-02-06 10:04:34,896 INFO: {'orderXml': None, 'cartXml': None, 'noStockSkuIds': '65437208345', 'reqInfo': None, 'hasJxj': False, 'addedServiceList': None, 'overSea': False, 'sign': None, 'pin': 'jd_5f981a661de60', 'needCheckCode': False, 'success': False, 'resultCode': 600158, 'orderId': 0, 'submitSkuNum': 0, 'deductMoneyFlag': 0, 'goJumpOrderCenter': False, 'payInfo': None, 'scaleSkuInfoListVO': None, 'purchaseSkuInfoListVO': None, 'noSupportHomeServiceSkuList': None, 'msgMobile': None, 'addressVO': {'used': False, 'oldAddress': False, 'mapping': False, 'pin': 'jd_5f981a661de60', 'areaName': '', 'provinceId': 22, 'cityId': 2016, 'countyId': 2020, 'townId': 7902, 'paymentId': 0, 'showChangeJingAddressFlag': None, 'selected': False, 'addressDetail': 'xxxx', 'mobile': '1990902xxxx', 'idCard': '', 'phone': None, 'selfPickOptimize': 0, 'consigneeId': 0, 'email': None, 'selfPickMobile': None, 'selfPickPhone': None, 'selectedAddressType': 0, 'addressType': 0, 'provinceName': None, 'cityName': None, 'countyName': None, 'townName': None, 'addressName': None, 'areaCode': None, 'nameCode': None, 'postCode': None, 'giftSenderConsigneeName': None, 'giftSenderConsigneeMobile': None, 'gcLat': 0.0, 'gcLng': 0.0, 'coord_type': 0, 'longitude': 0.0, 'latitude': 0.0, 'fullAddress': '四川广安市广安区xxxxx', 'freePay': False, 'addressDefault': False, 'selfPickAddressShuntFlag': 0, 'pickId': 0, 'pickName': None, 'pickVOselected': False, 'mapUrl': None, 'branchId': 0, 'canSelected': False, 'siteType': 0, 'helpMessage': None, 'tipInfo': None, 'cabinetAvailable': True, 'limitKeyword': 0, 'specialRemark': None, 'siteProvinceId': 0, 'siteCityId': 0, 'siteCountyId': 0, 'siteTownId': 0, 'skuSupported': False, 'addressSupported': 0, 'isCod': 0, 'consigneeName': None, 'pickVOname': None, 'shipmentType': 0, 'retTag': 0, 'tagSource': 0, 'userDefinedTag': None, 'newProvinceId': 0, 'newCityId': 0, 'newCountyId': 0, 'newTownId': 0, 'newProvinceName': None, 'newCityName': None, 'newCountyName': None, 'newTownName': None, 'checkLevel': 0, 'optimizePickID': 0, 'pickType': 0, 'dataSign': 0, 'overseas': 0, 'appSelfPickAddress': 0, 'associatePickId': 0, 'associateAddressId': 0, 'appId': None, 'encryptText': None, 'certNum': None, 'addressDefaultCancel': None, 'updateTime': None, 'lastOrderAddress': False, 'sendMq': 0, 'addressMapperInfoVO': None, 'address': None, 'name': 'xx', 'message': None, 'id': 0}, 'msgUuid': None, 'message': '代尔塔 高端可折叠舒适口罩 欧标FFP2黄阀/FFP3红阀 带呼吸阀 防尘 防雾霾口罩 红阀(10只盒装)商品无货'}
2020-02-06 10:04:34,896 INFO: 休息3s
其他页面的连接都是正常的

新版本运行出错

Traceback (most recent call last):
File "D:/py工程/jdmask/jdBuyMask.py", line 129, in
name, value = item.strip().split('=', 1)
ValueError: not enough values to unpack (expected 2, got 1)

cmd运行一段时间后停止

你好,我在cmd上运行v2时,大概在查询200-1200之后便会停止。取消了快速编辑模式后也没有解决。怀疑是网络不稳定造成的停止,是否可以在网络不稳后过一段时间再尝试连接一次?

No module named 'requests'

Traceback (most recent call last):
File "D:/jd/new.py", line 5, in
import requests
ModuleNotFoundError: No module named 'requests'

老师您好我是新手
直接运行脚本提示这个我把
beautifulsoup4==4.8.2
requests==2.22.0

添加进去提示
invalid syntax
为了买口罩真的太感谢这个脚本了可是我弄不成
希望老师能教教我

v2运行出错

python3 jdBuyMask_V2.py
Traceback (most recent call last):
File "/usr/lib/python3.7/configparser.py", line 788, in get
value = d[option]
File "/usr/lib/python3.7/collections/init.py", line 916, in getitem
return self.missing(key) # support subclasses that define missing
File "/usr/lib/python3.7/collections/init.py", line 908, in missing
raise KeyError(key)
KeyError: 'messagetype'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "jdBuyMask_V2.py", line 28, in
messageType = global_config.getRaw('config', 'messageType')
File "/root/jdBuyMask/config.py", line 20, in getRaw
return self._configRaw.get(section, name)
File "/usr/lib/python3.7/configparser.py", line 791, in get
raise NoOptionError(option, section)
configparser.NoOptionError: No option 'messagetype' in section: 'config'

skuid最大能存储100个ID 多了就会提示无货

raceback (most recent call last):
File "E:/学习/python/口罩/2020.02.06/jdBuyMask-master/jdBuyMask_V2.py", line 484, in
inStockSkuid = check_stock()
File "E:/学习/python/口罩/2020.02.06/jdBuyMask-master/jdBuyMask_V2.py", line 462, in check_stock
if respjson[i]['StockStateName'] != '无货':
KeyError: '100006784140'

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.