Skip to content

Commit

Permalink
暂不更新代码
Browse files Browse the repository at this point in the history
  • Loading branch information
cycz committed Feb 13, 2020
1 parent 7c264f2 commit 45a9e85
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 35 deletions.
5 changes: 3 additions & 2 deletions AreaTool.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
from jdlogger import logger

'''
找一条第一个版本的url
测试 https://c0.3.cn/stock?skuId=100003406321&area=19_1607_4773_0&venderId=1000000946&buyNum=1&choseSuitSkuIds=&cat=9192,9197,12588&extraParam={%22originid%22:%221%22}&fqsp=0&pdpin=jd_7c3992aa27d1a&pduid=1580535906442142991701&ch=1&callback=jQuery4291064
请看教程寻找自己的url
'''
url = 'https://c0.3.cn/stock?skuId=100003406321&area=19_1607_4773_0&venderId=1000000946&buyNum=1&choseSuitSkuIds=&cat=9192,9197,12588&extraParam={%22originid%22:%221%22}&fqsp=0&pdpin=jd_7c3992aa27d1a&pduid=1580535906442142991701&ch=1&callback=jQuery4291064'
url = ''
skuId = url.split('skuId=')[1].split('&')[0]
area = url.split('area=')[1].split('&')[0]
logger.info('你的area是[ %s ],链接的商品id是[ %s ]', area, skuId)
15 changes: 7 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
****
如果帮助到你,star一下,谢谢你
发现有人滥用,代码暂不更新了。

武汉加油,中国加油
exe版本仅能购买一件,定时过期。

祝大家早点买到**自己所需**的口罩
****
使用方法 : https://blog.csdn.net/cyz52/article/details/104239558
## exe版本[口罩小助手] 最多添加99种口罩
Expand All @@ -11,15 +13,15 @@
看到有人在闲鱼转卖口罩,打码的接口已经改了
有需要的说明原因,加群要吧(1053467385)

代码暂不更新了。

祝大家早点买到口罩


![image](https://github.com/cycz/jdBuyMask/blob/master/pic/1581486475(1).jpg)
![image](https://github.com/cycz/jdBuyMask/blob/master/pic/1581486486(1).jpg)

避免抢购,程序自动一次只买一件
## V2版本
## V2版本(已不更新)
请在configDemo.ini 加入商品id、地区id、cookie等参数
区分下单模式(默认2正常模式)

Expand All @@ -37,7 +39,7 @@
- [x] 加入购物车
- [x] 下单

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

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

Expand All @@ -50,9 +52,6 @@ V3
- [x] 检测有货
- [x] 下单

## exe版本
进群要吧,地址随时变,就不放了。


## 温馨提示
- 在京东购物车结算页面设置发票为电子普通发票-个人设置支付方式为在线支付
Expand Down
31 changes: 19 additions & 12 deletions jdBuyMask_V2.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# -*- coding=utf-8 -*-
'''
2020/2/13
(避免滥用,代码已经废弃,现已不更新,有需要请适量使用exe版本)
京东抢购口罩程序
通过商品的skuid、地区id抢购
'''
Expand Down Expand Up @@ -470,24 +472,31 @@ def fastModeAutoBuy(inStockSkuid):
remove_item()


def check_Config():
global configMd5, configTime
nowMd5 = getconfigMd5()
configTime = time.time()
if not nowMd5 == configMd5:
logger.info('配置文件修改,重新读取文件')
getconfig()
configMd5 = nowMd5


def normalMode():
flag = 1
while (1):
try:
if flag == 1:
validate_cookies()
getUsername()
# 检测配置文件修改
if int(time.time()) - configTime >= 600:
nowMd5 = getconfigMd5()
if not nowMd5 == configMd5:
logger.info('配置文件修改,重新读取文件')
getconfig()
# 检测配置文件是否修改
if int(time.time()) - configTime >= 60:
check_Config()
# modelType
logger.info('第' + str(flag) + '次 ')
flag += 1
# 检测库存
inStockSkuid = check_stock()
inStockSkuid = check_stock(checksession, skuids, area)
# 下单任务
normalModeAutoBuy(inStockSkuid)
# 休眠模块
Expand All @@ -513,10 +522,7 @@ def fastMode():
remove_item()
# 检测配置文件修改
if int(time.time()) - configTime >= 600:
nowMd5 = getconfigMd5()
if not nowMd5 == configMd5:
logger.info('配置文件修改,重新读取文件')
getconfig()
check_Config()
# modelType
logger.info('第' + str(flag) + '次 ')
flag += 1
Expand All @@ -535,7 +541,8 @@ def fastMode():
print(traceback.format_exc())
time.sleep(10)

_setDNSCache()

# _setDNSCache()
if modelType == '2':
logger.info('V2版本当前模式[普通模式]')
normalMode()
Expand Down
26 changes: 17 additions & 9 deletions jdBuyMask_V3.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# -*- coding=utf-8 -*-
'''
京东抢购口罩程序
通过商品的skuid、地区id抢购
2020/2/13
(避免滥用,代码已经废弃,现已不更新,有需要请适量使用exe版本)
京东抢购口罩程序V3版本
'''
import sys
import traceback
Expand Down Expand Up @@ -52,7 +53,6 @@ def getconfig():
payment_pwd = global_config.getRaw('config', 'payment_pwd')



# 初次
configTime = int(time.time())
getconfig()
Expand Down Expand Up @@ -446,7 +446,18 @@ def V3AutoBuy(inStockSkuid):
logger.info('[%s]已下柜商品', skuId)
sys.exit(1)

_setDNSCache()

def check_Config():
global configMd5, configTime
nowMd5 = getconfigMd5()
configTime = time.time()
if not nowMd5 == configMd5:
logger.info('配置文件修改,重新读取文件')
getconfig()
configMd5 = nowMd5


# _setDNSCache()
if len(skuids) != 1:
logger.info('请准备一件商品')
skuId = skuids[0]
Expand All @@ -462,11 +473,8 @@ def V3AutoBuy(inStockSkuid):
remove_item()
add_item_to_cart(skuId)
# 检测配置文件修改
if int(time.time()) - configTime >= 600:
nowMd5 = getconfigMd5()
if not nowMd5 == configMd5:
logger.info('配置文件修改,重新读取文件')
getconfig()
if int(time.time()) - configTime >= 60:
check_Config()
logger.info('第' + str(flag) + '次 ')
flag += 1
# 检查库存模块
Expand Down
14 changes: 10 additions & 4 deletions jdProgram.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# -*- coding=utf-8 -*-
'''
查询库存
'''

import json
import random
import time
Expand All @@ -13,6 +11,14 @@
from util import parse_json, response_status
import traceback

'''
2020/2/13
(避免滥用,代码已经废弃,现已不更新,有需要请适量使用exe版本)
'''
'''
查询库存(旧)
'''


def check_stock(checksession, skuids, area):
start = int(time.time() * 1000)
Expand All @@ -23,7 +29,7 @@ def check_stock(checksession, skuids, area):
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3",
"Referer": "https://cart.jd.com/cart.action",
"Connection": "keep-alive",
"Host":"c0.3.cn"
"Host": "c0.3.cn"
}
#
url = 'https://c0.3.cn/stocks'
Expand Down

0 comments on commit 45a9e85

Please sign in to comment.