def buy(): today = '2020-03-07' sku_ids = '100006394713' # 商品id area = '19_1607_3155' # 区域id yue_yue_time = '{0} 15:00:01.5'.format(today) # 预约时间 buy_time = '{0} 20:00:00.5'.format(today) asst = Assistant() # 初始化 asst.login_by_QRcode() # 扫码登陆 asst.make_reserve_by_time(sku_ids, yue_yue_time) # 执行预约 # asst.exec_reserve_seckill_by_time(sku_ids, buy_time, 4, 1.5) # 执行抢购 asst.exec_seckill_by_time(sku_ids, buy_time, 10, 0.5, 1)
def boot_ass(): asst = Assistant() # 初始化 asst.login_by_QRcode() # 扫码登陆 # # 执行【预约抢购,自动加入购物车】 手动清空自动添加到购物车的 # asst.exec_reserve_seckill_by_time(sku_id=sku_id, buy_time=buy_time, retry=retry, interval=interval, num=num, # is_pass_cart=is_pass_cart, sleep_interval=sleep_interval, # fast_sleep_interval=fast_sleep_interval) # 执行【预约抢购,不会自动加入购物车】 asst.exec_seckill_by_time(sku_ids=sku_id, buy_time=buy_time, num=num, fast_mode=fast_mode)
def buy(): sku_ids = '100011521400' # 商品id area = '19_1607_3155' # 区域id today = datetime.datetime.now() tomorow = today + datetime.timedelta(days=1) yue_yue_time = '{0} 21:00:01.5'.format( today.strftime("%Y-%m-%d")) # 预约时间 #buy_time = '{0} 10:00:00.1'.format(tomorow.strftime("%Y-%m-%d")) buy_time = '2020-03-11 10:00:00.5' asst = Assistant() # 初始化 asst.login_by_QRcode() # 扫码登陆 #asst.make_reserve_by_time(sku_ids, yue_yue_time) # 执行预约 asst.exec_seckill_by_time(sku_ids, buy_time, 10, 0.5, 1) # 执行抢购
self.asst = asst def run(self): self.asst.make_reserve_on_time(self.skuid, self.reserve_time) if __name__ == '__main__': sku_ids = '65708238590,100011521400,65624145328,100006394713,100011551632' # 商品id sku_nums = '1,1,1,1,1' all_reserve_time = '10:59:30.000,20:59:30.000,10:59:30.000,14:59:30.000,14:59:30.000' all_buy_time = '17:00:00.050,10:00:00.050,15:00:00.050,20:00:00.050,20:00:00.050' area = '6_303_36780_56047' # 区域id max_reserve_threads_num = 6 asst = Assistant() # 初始化 asst.login_by_QRcode() # 扫码登陆 # 转list和dict sku_ids_list = parse_sku_id_to_list(sku_ids) reserve_time_list = parse_time(all_reserve_time) buy_time_list = parse_time(all_buy_time) i = 0 for (sku_id, reserve_time, buy_time, sku_num) in zip(sku_ids_list, reserve_time_list, buy_time_list, sku_nums): local_time = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(time.time())) if reserve_time[:len(local_time)] > local_time:
#!/usr/bin/env python # -*- coding:utf-8 -*- from jd_assistant import Assistant if __name__ == '__main__': """ 重要提示:此处为示例代码之一,请移步下面的链接查看使用教程👇 https://github.com/tychxn/jd-assistant/wiki/1.-%E4%BA%AC%E4%B8%9C%E6%8A%A2%E8%B4%AD%E5%8A%A9%E6%89%8B%E7%94%A8%E6%B3%95 """ asst = Assistant() # 初始化 asst.login_by_QRcode() # 扫码登陆 asst.clear_cart() asst.exec_reserve_seckill_by_time(sku_id="100006047279", buy_time="2020-01-17 20:00:00.001") # 执行预约抢购 # 5个参数 # sku_id: 商品id # buy_time: 下单时间,例如:'2019-11-10 22:41:30.000' # retry: 抢购重复执行次数,可选参数,默认4次 # interval: 抢购执行间隔,可选参数,默认4秒 # num: 购买数量,可选参数,默认1个
#!/usr/bin/env python # -*- coding:utf-8 -*- from jd_assistant import Assistant if __name__ == '__main__': """ 重要提示:此处为示例代码之一,请移步下面的链接查看使用教程👇 https://github.com/tychxn/jd-assistant/wiki/1.-%E4%BA%AC%E4%B8%9C%E6%8A%A2%E8%B4%AD%E5%8A%A9%E6%89%8B%E7%94%A8%E6%B3%95 """ sku_ids = '100014391708' # 商品id area = '2_2830_51810' # 区域id asst = Assistant() # 初始化 asst.login_by_QRcode() # 扫码登陆 asst.buy_item_in_stock(sku_ids=sku_ids, area=area, submit_interval=5, timerMode=True) # 根据商品是否有货自动下单 # 6个参数: # sku_ids: 商品id。可以设置多个商品,也可以带数量,如:'1234' 或 '1234,5678' 或 '1234:2' 或 '1234:2,5678:3' # area: 地区id # wait_all: 是否等所有商品都有货才一起下单,可选参数,默认False # stock_interval: 查询库存时间间隔,可选参数,默认3秒 # submit_retry: 提交订单失败后重试次数,可选参数,默认3次 # submit_interval: 提交订单失败后重试时间间隔,可选参数,默认5秒
from jd_assistant import Assistant from datetime import date from log import logger from datetime import datetime import time from timer import Timer if __name__ == '__main__': """ 重要提示:此处为示例代码之一,请移步下面的链接查看使用教程👇 https://github.com/tychxn/jd-assistant/wiki/1.-%E4%BA%AC%E4%B8%9C%E6%8A%A2%E8%B4%AD%E5%8A%A9%E6%89%8B%E7%94%A8%E6%B3%95 """ sku_ids = '100012043978' # 商品id area = '16_1303_48716_48765' # 区域id asst = Assistant() # 初始化 asst.login_by_QRcode() # 扫码登陆 # asst.buy_item_in_stock(sku_ids=sku_ids, area=area, wait_all=False, stock_interval=5) # 根据商品是否有货自动下单 buydate = date.today() bt = str(buydate) + " 10:00:00.000" logger.error(bt) time_c = Timer(bt) buy_time = time_c.get_time_stamp() # ns # TODO 之后将上面的方法写成库 获取时间戳 再获取到对应的网络时间, 我们就可以知道要间隔多久的时间了 之后 只要看时间戳到位没有就可以进行抢购了 logger.error(buy_time) # diff_time = int(time_c.get_server_difference(url='https://a.jd.com//ajax/queryServerData.html')) # logger.info(diff_time) # asst.add_item_to_cart(sku_ids=sku_ids) asst.exec_seckill_by_time_stamp( sku_ids=sku_ids, buy_time=bt,
#!/usr/bin/env python # -*- coding:utf-8 -*- from jd_assistant import Assistant if __name__ == '__main__': """ 重要提示:此处为示例代码之一,请移步下面的链接查看使用教程👇 https://github.com/tychxn/jd-assistant/wiki/1.-%E4%BA%AC%E4%B8%9C%E6%8A%A2%E8%B4%AD%E5%8A%A9%E6%89%8B%E7%94%A8%E6%B3%95 """ sku_ids = '100018276690' # 商品id area = '12_904_905_50601' # 区域id asst = Assistant() # 初始化 asst.login_by_QRcode() # 扫码登陆 # asst.add_item_to_cart(sku_ids=sku_ids) print(asst.get_preorder_list()) # asst.exec_reserve_seckill_by_time(sku_id=sku_ids, buy_time='2021-03-22 11:18:59.99800', retry=4, interval=5) # asst.submit_order_by_time(buy_time='2021-03-17 16:00:00.000', retry=4, interval=5) # 定时提交订单 # asst.buy_item_in_stock(sku_ids=sku_ids, area=area, wait_all=False, stock_interval=5) # 根据商品是否有货自动下单 # 6个参数: # sku_ids: 商品id。可以设置多个商品,也可以带数量,如:'1234' 或 '1234,5678' 或 '1234:2' 或 '1234:2,5678:3' # area: 地区id # wait_all: 是否等所有商品都有货才一起下单,可选参数,默认False # stock_interval: 查询库存时间间隔,可选参数,默认3秒 # submit_retry: 提交订单失败后重试次数,可选参数,默认3次 # submit_interval: 提交订单失败后重试时间间隔,可选参数,默认5秒
#!/usr/bin/env python # -*- coding:utf-8 -*- from jd_assistant import Assistant if __name__ == '__main__': """ 重要提示:此处为示例代码之一,请移步下面的链接查看使用教程👇 https://github.com/tychxn/jd-assistant/wiki/1.-%E4%BA%AC%E4%B8%9C%E6%8A%A2%E8%B4%AD%E5%8A%A9%E6%89%8B%E7%94%A8%E6%B3%95 """ sku_ids = '100012043978' # 茅台商品id area = '19_1609_41655_41710' # 区域id asst = Assistant() # 初始化 asst.login_by_QRcode() # 扫码登陆 # asst.clear_cart() # 清空购物车(可选) # asst.add_item_to_cart(sku_ids='100016117840') # 根据商品id添加购物车(可选) # asst.submit_order_by_time(buy_time='2020-11-10 20:59:59.700', retry=4, interval= 0.5) #普通订单可用 # asst.exec_seckill_by_time(sku_ids =sku_ids,buy_time='2020-11-10 23:59:59.700', retry=5, interval= 0.5) # 定时提交秒杀订单 asst.exec_reserve_seckill_by_time(sku_id='100016117840', buy_time='2020-11-11 07:59:59.975', retry=4, interval=0.2) #该秒杀会放入购物车 # asst.buy_item_in_stock(sku_ids=sku_ids, area=area, wait_all=False, stock_interval=5) # 根据商品是否有货自动下单 # 6个参数: # sku_ids: 商品id。可以设置多个商品,也可以带数量,如:'1234' 或 '1234,5678' 或 '1234:2' 或 '1234:2,5678:3' # area: 地区id # wait_all: 是否等所有商品都有货才一起下单,可选参数,默认False # stock_interval: 查询库存时间间隔,可选参数,默认3秒 # submit_retry: 提交订单失败后重试次数,可选参数,默认3次 # submit_interval: 提交订单失败后重试时间间隔,可选参数,默认5秒
#!/usr/bin/env python # -*- coding:utf-8 -*- from jd_assistant import Assistant if __name__ == '__main__': """ 重要提示:此处为示例代码之一,请移步下面的链接查看使用教程👇 https://github.com/tychxn/jd-assistant/wiki/1.-%E4%BA%AC%E4%B8%9C%E6%8A%A2%E8%B4%AD%E5%8A%A9%E6%89%8B%E7%94%A8%E6%B3%95 """ sku_id = '100012043978' # 商品id area = '1_72_4211' # 区域id asst = Assistant() # 初始化 asst.login_by_QRCode() # 扫码登陆 #asst.submit_order() #asst.submit_order_with_retry(retry=3, interval=4) #asst.buy_item_in_stock(sku_ids=sku_ids, area=area, wait_all=False, stock_interval=5) # 根据商品是否有货自动下单 #asst.submit_order_by_time(buy_time='2020-11-11 00:00:03.500', retry=4, interval=5) # 定时提交订单 asst.exec_seckill_by_time(sku_ids=sku_id, buy_time='2020-12-31 09:59:59.500', retry=4, interval=4, num=1) # 6个参数: # sku_ids: 商品id。可以设置多个商品,也可以带数量,如:'1234' 或 '1234,5678' 或 '1234:2' 或 '1234:2,5678:3' # area: 地区id # wait_all: 是否等所有商品都有货才一起下单,可选参数,默认False # stock_interval: 查询库存时间间隔,可选参数,默认3秒 # submit_retry: 提交订单失败后重试次数,可选参数,默认3次 # submit_interval: 提交订单失败后重试时间间隔,可选参数,默认5秒
from jd_assistant import Assistant import time,datetime if __name__ == '__main__': assi = Assistant() #100010428315,100018640836,100018640794,100010428313,100018640832,100018640798, sku_ids = '100009808185' # 商品id area = '1_2800_2850' # 区域id while True: for sku_id in sku_ids.split(","): flag = assi.get_single_item_stock(sku_id,1,area) if flag: print(sku_id + str(datetime.datetime.now()) +" 有货" ) else: print("无货") time.sleep(3)
if __name__ == '__main__': """ 重要提示:此处为示例代码之一,请移步下面的链接查看使用教程👇 https://github.com/tychxn/jd-assistant/wiki/1.-%E4%BA%AC%E4%B8%9C%E6%8A%A2%E8%B4%AD%E5%8A%A9%E6%89%8B%E7%94%A8%E6%B3%95 """ # sku_ids 商品id # sku_ids = '100011521400' # 振德 (ZHENDE) 口罩一次性医用口罩 预约21点 抢购10点 数量3000 # sku_ids = '100011551632' # 3Q医用口罩 预约15点 抢购20点 数量10000 # sku_ids = '65708238590' # 袋鼠医生 预约15点 抢购20点 数量?? sku_ids = '100011551632' area = '12_904_905_50601' # 区域id buy_time = '2020-02-16 01:17:59.500' # 下单时间 asst = Assistant() # 初始化 asst.login_by_QRcode() # 扫码登陆 # 1.根据商品id添加购物车,下单 asst.add_item_to_cart(sku_ids=sku_ids) # 提交订单 asst.submit_order() # 2.清空购物车,下单 # asst.clear_cart() # asst.submit_order() # 提交订单 # 4.定时提交订单示例(常用) # asst.submit_order_by_time(buy_time=buy_time, retry=4, interval=5) # 定时提交订单 # 3个参数: # buy_time: 下单时间,例如:'2019-02-16 01:17:59.500'
定时预约功能 https://github.com/tychxn/jd-assistant/pull/109 """ # sku_ids 商品id # sku_ids = '100011521400' # 振德 (ZHENDE) 口罩一次性医用口罩 预约21点 抢购10点 数量3000 # sku_ids = '100011551632' # 3Q医用口罩 预约15点 抢购20点 数量10000 # sku_ids = '65708238590' # 袋鼠医生 预约15点 抢购20点 数量?? sku_ids = '100011521400' area = '12_904_905_50601' # 区域id reserve_time = '2020-02-29 21:00:02.500' # 预约时间 buy_time = '2020-02-29 10:00:00.800' # 抢购时间 asst = Assistant() # 初始化 asst.login_by_QRcode() # 扫码登陆 # 1.预约商品 # asst.make_reserve(sku_id=sku_ids, buy_time=reserve_time) # 2个参数 # sku_id: 商品id # buy_time: 预约时间,例如:'2019-11-10 22:41:30.000' # 2.定时抢购商品(可以加入购物车) asst.exec_reserve_seckill_by_time(sku_id=sku_ids, buy_time=buy_time, retry=2, interval=2, num=1) # 5个参数
else: notify = False if __name__ == '__main__': """ 重要提示:此处为示例代码之一,请移步下面的链接查看使用教程👇 https://github.com/tychxn/jd-assistant/wiki/1.-%E4%BA%AC%E4%B8%9C%E6%8A%A2%E8%B4%AD%E5%8A%A9%E6%89%8B%E7%94%A8%E6%B3%95 """ if not TESTING: sku_ids = [ 100006784140, 100006784144, 100010222606, 100006248177, 1835968, 1835967, 100005151507, 100005818743, 100002690344, 100010638508, 100009445348, 100009441994, 100009109410, 100006248247, 4642656, 100009130434, 7498167, 51137726169, 6046611, 59959871345 ] skus = ','.join(f'{i}:1' for i in sku_ids) with Assistant() as asst: asst.login_by_QRcode() # 扫码登陆 asst.clear_cart() # asst.exec_reserve_seckill_by_time(sku_id="100009083498", buy_time="2019-11-10 22:42:30.000") asst.buy_item_in_stock( sku_ids=skus, area='18_1495_29449_30737', submit_retry=5, stock_interval=1, submit_interval=5, then_callbacks=[telegram_success_notify_callback] if notify else None) else: with Assistant() as asst: asst.login_by_QRcode() # 扫码登陆 asst.clear_cart() # 清空购物车(可选)
#!/usr/bin/python # -*- coding: UTF-8 -*- from jd_assistant import Assistant from dateutil.parser import parse import time if __name__ == '__main__': """ 重要提示:此处为示例代码之一,请移步下面的链接查看使用教程👇 https://github.com/tychxn/jd-assistant/wiki/1.-%E4%BA%AC%E4%B8%9C%E6%8A%A2%E8%B4%AD%E5%8A%A9%E6%89%8B%E7%94%A8%E6%B3%95 """ # 商品id 飞天茅台53:100012043978; # 小米路由AX3600:100011385902; # 惠寻一次性医用口罩: 66235396248; # 3Q一次性医用外科口罩: 100011551632; # 袋鼠医生(DR.ROOS)医用外科口罩: 100006394713; sku_ids = '100012043978' area = '1_2801_54769' # 区域id asst = Assistant() # 初始化 asst.login_by_QRcode() # 扫码登陆 asst.make_reserve(sku_ids)
#!/usr/bin/env python # -*- coding:utf-8 -*- from jd_assistant import Assistant if __name__ == '__main__': asst = Assistant() # 初始化 asst.login_by_QRcode() # 扫码登陆 asst.clear_cart() # 清空购物车(可选) asst.add_item_to_cart(sku_ids='100011293950') # 根据商品id添加购物车(可选) asst.submit_order_by_stock(sku_ids='100011293950', area='27_2376_50230_53680') # 监控的商品id和地址id # 3个参数: # sku_ids: 商品id # area: 地区id # interval: 查询库存间隔,可选参数,默认为3秒/次
#!/usr/bin/env python3 # -*- coding:utf-8 -*- from jd_assistant import Assistant if __name__ == '__main__': """ 重要提示:此处为示例代码之一,请移步下面的链接查看使用教程👇 https://github.com/tychxn/jd-assistant/wiki/1.-%E4%BA%AC%E4%B8%9C%E6%8A%A2%E8%B4%AD%E5%8A%A9%E6%89%8B%E7%94%A8%E6%B3%95 """ sku_ids = '100018640844' # 商品id area = '22_1930_50948_52157' # 区域id asst = Assistant() # 初始化 asst.login_by_cookieString( 'shshshfpa=8b257df8-2b37-cc1b-3876-5893bc4b63e9-1610602086; shshshfpb=t49povbqrojZaUTLkiyvtww%3D%3D; __jdu=456735623; pinId=NyozGQScbNI; pin=zg_vip; unick=zg_vip; _tp=t2ytaFS9aCz0Mc%2FHdtnE3w%3D%3D; _pst=zg_vip; areaId=22; user-key=f6f2a91e-d1e7-40b2-9d98-a6c3b592c1ae; ipLocation=%u56db%u5ddd; __jdv=76161171|direct|-|none|-|1615863684940; mt_xid=V2_52007VwYWVVtaVl0cSykOBzAHRlFaX04NFkkdQABmBkVODlkFWgMdTl4BNFRFBwkPAVgvShhfBXsCEE5dX0NaGEIcVQ5lBCJSbVhiWBpOGF4DYQETUm1dUVwc; ceshi3.com=000; cn=0; shshshfp=bf9d21c40bb8fec0e32ac05784dfa6d3; ipLoc-djd=22-1930-50948-52157; __jdc=122270672; __jda=122270672.456735623.1610602084.1616032169.1616120729.19; wlfstk_smdl=k768x8ndc4e9ph9om7az9x0lvt39mql7; 3AB9D23F7A4B3C9B=5TFN4KA3OZ5HMLRAEUA7VKDL3L44GIHLMNVN2PBIBFXGUJEMH3A5DJBEYDFXUXECDR22I7LERPTJL4L7EG23XDUGT4; TrackID=1koXNjPZqRp7TjbAZML99eQyMB-CtyyejN3DB5VU_FgsijsFy6Cn_8mQeczbHk2_qTYUKyS1zQzua7JXqsPHsn3BYKV0aIhp3lKOLv35QVO8wzwW1ZnClg-PXkH-IeB2N; thor=524A4B2233BB30EA2F3A0A22953B428A316FCBED385DE5494C629AC8B811082EAD616A971485E383F43BE4495A0890623D44695C12F8B0FB48E940FFAE9FDE9D41B9D69E6D50D2001E2830EF9A8FD4E271FCD507C440754715F3E809B2F52C7B8A0A8DE1A8044EB99533003875D4ECF85211BCDCDEC3468BBA7554985EB2469B; __jdb=122270672.7.456735623|19.1616120729' ) asst.login_by_QRcode() # 扫码登陆 # (self, sku_id, buy_time, retry=4, interval=4, num=1): #k40 幻境 asst.exec_seckill_by_time('100018640796', '2021-03-19 10:00:00.001', retry=10, interval=0.1) #motorola edge s # asst.exec_reserve_seckill_by_time('100018071914', '2021-03-18 10:00:00.001', retry=10, interval= 6) # asst.exec_seckill_by_time('100018071914', '2021-03-18 10:00:00.001') # asst.exec_reserve_seckill_by_time('100018640796', '2021-03-8 10:00:00.001', retry=10, interval= 6) # '' # sku_ids = '100018071914'
#!/usr/bin/env python # -*- coding:utf-8 -*- from jd_assistant import Assistant if __name__ == '__main__': asst = Assistant() asst.login_by_QRcode() # 扫码登陆 asst.clear_cart() # 清空购物车 asst.add_item_to_cart(sku_id='1626336666') # 添加到购物车 # 3种订单提交方式: # 1.直接提交订单 # asst.submit_order() # 2.有货时提交订单 asst.submit_order_by_stock(sku_id='1626336666', area='1_2802_2821') # 监控的商品id和地址id # 3.定时提交订单 # asst.submit_order_by_time(buy_time='2018-10-19 00:00:00.500', retry=3, interval=5) asst.get_order_info(unpaid=False) # 查询未付款订单 """ 输出实例: [2018-10-19 02:38:58] 登录成功 [2018-10-19 02:38:58] 购物车清空成功 [2018-10-19 02:38:58] 1626336666已成功加入购物车 [2018-10-19 02:38:59] 1626336666有货了,正在提交订单…… [2018-10-19 02:38:59] 订单提交成功! 订单号:811545xxxxx ************************订单列表页查询************************ 订单号:811545xxxxx----下单时间:2018-10-19 02:38:59----商品列表:1626336666 x 1----订单状态:等待付款----总金额:89.90元----付款方式:在线支付 """
#!/usr/bin/env python # -*- coding:utf-8 -*- from jd_assistant import Assistant if __name__ == '__main__': """ 重要提示:此处为示例代码之一,请移步下面的链接查看使用教程👇 https://github.com/tychxn/jd-assistant/wiki/1.-%E4%BA%AC%E4%B8%9C%E6%8A%A2%E8%B4%AD%E5%8A%A9%E6%89%8B%E7%94%A8%E6%B3%95 """ asst = Assistant() # 初始化 asst.login_by_QRcode() # 扫码登陆 asst.exec_seckill_by_time(sku_id='100002852990', buy_time='2019-02-19 09:59:59.500', retry=10, interval=4) # 5个参数: # sku_id: 商品id # buy_time: 下单时间,例如:'2019-02-19 09:59:59.500' # retry: 抢购重复执行次数,可选参数,默认4次 # interval: 抢购执行间隔,可选参数,默认4秒 # num: 购买数量,可选参数,默认1个
""" ''' 100016578654 6800xt 26 11:00 100008550195 3080 26 11:00 100019176614 6700xt 26 11:00 100016046826 3070 26 11:00 100016672406 3090 26 11:00 100008979445 3070 26 15:00 10027264803895 3060ti 27 12:00 100016914910 3060ti 29 11:00 ''' sku_ids = '10026920091878' # 商品id # sku_ids = ['100019176614', '100016578654', '100008550195', '100016046826', '100016672406'] area = '1_2800_4209' # 区域id asst = Assistant() # 初始化 asst.login_by_QRcode() # 扫码登陆 # for i in sku_ids: asst.exec_reserve_seckill_by_time(sku_id=sku_ids, buy_time='2021-03-27 12:00:00.000') # asst.buy_item_in_stock(sku_ids=sku_ids, area=area, wait_all=False, stock_interval=3) # 根据商品是否有货自动下单 # 6个参数: # sku_ids: 商品id。可以设置多个商品,也可以带数量,如:'1234' 或 '1234,5678' 或 '1234:2' 或 '1234:2,5678:3' # area: 地区id # wait_all: 是否等所有商品都有货才一起下单,可选参数,默认False # stock_interval: 查询库存时间间隔,可选参数,默认3秒 # submit_retry: 提交订单失败后重试次数,可选参数,默认3次 # submit_interval: 提交订单失败后重试时间间隔,可选参数,默认5秒
#!/usr/bin/env python # -*- coding:utf-8 -*- from jd_assistant import Assistant if __name__ == "__main__": sku_ids = "" # 商品id buy_time = "" # 下单时间 asst = Assistant() # 初始化 asst.login_by_QRcode() # 扫码登陆 asst.clear_cart() # 清空购物车(可选) asst.add_item_to_cart(sku_ids=sku_ids) # 根据商品id添加购物车(可选) asst.submit_order_by_time(buy_time=buy_time, retry=10000, interval=5) # 定时提交订单 # 3个参数: # buy_time: 下单时间,例如:'2019-02-16 01:17:59.500' # retry: 下单重复执行次数,可选参数,默认4次 # interval: 下单执行间隔,可选参数,默认5秒
#!/usr/bin/env python # -*- coding:utf-8 -*- from jd_assistant import Assistant import random if __name__ == '__main__': asst = Assistant() # 初始化 asst.login_by_QRcode() # 扫码登陆 print("定时预约抢购...") sku_id = '100012043978' asst.print_item_info(sku_id) reserve_info = asst.get_reserve_info(sku_id) reserve_time = reserve_info.get("yueStime") buy_time = reserve_info.get("qiangStime") print("预约时间:", reserve_time) print("抢购时间:", buy_time) # 开始预约 if reserve_time: asst.make_reserve(sku_id, reserve_time + '.000') else: print('获取预约时间失败') # 开始抢购 if buy_time: rand_msecond = random.randint(1, 9) * 1000 buy_time = buy_time + '.000' #buy_time = buy_time + "." + str(rand_msecond) else: print('获取抢购时间失败') buy_time = input("请输入抢购时间(2020-03-04 00:59:59.000):") #asst.exec_reserve_seckill_by_time(sku_id=sku_id,buy_time=time, retry=10, interval=1,num=1) asst.exec_seckill_by_time(sku_ids=sku_id,
#!/usr/bin/env python # -*- coding:utf-8 -*- from jd_assistant import Assistant if __name__ == '__main__': """ 重要提示:此处为示例代码之一,请移步下面的链接查看使用教程👇 https://github.com/tychxn/jd-assistant/wiki/1.-%E4%BA%AC%E4%B8%9C%E6%8A%A2%E8%B4%AD%E5%8A%A9%E6%89%8B%E7%94%A8%E6%B3%95 """ #sku_ids = '65708238590:1, 57221392022:1, 65519834898:1,' sku_ids = '65708238590:1, 57221392022:1, 65519834898:1, 65533383512:1, 65426813242:1, 65426813241:1, \ 65420816727:1, 65420816726:1, 65778095377:1, 65698951225:1, 63556293656:1, 65698681192:1, 56122651035:1' # 商品id area = '19_1607_3155' # 区域id asst = Assistant() # 初始化 asst.login_by_QRcode() # 扫码登陆 asst.buy_item_in_stock(sku_ids=sku_ids, area=area, wait_all=False, stock_interval=5) # 根据商品是否有货自动下单 # 6个参数: # sku_ids: 商品id。可以设置多个商品,也可以带数量,如:'1234' 或 '1234,5678' 或 '1234:2' 或 '1234:2,5678:3' # area: 地区id # wait_all: 是否等所有商品都有货才一起下单,可选参数,默认False # stock_interval: 查询库存时间间隔,可选参数,默认3秒 # submit_retry: 提交订单失败后重试次数,可选参数,默认3次 # submit_interval: 提交订单失败后重试时间间隔,可选参数,默认5秒
retry = 5 # 抢购重复执行次数,可选参数,默认4次 interval = 0.01 # 抢购执行间隔,可选参数,默认4秒 num = 1 # 购买数量,可选参数,默认1个 sleep_interval = 0.5 # 抢购前倒计时轮询时间,默认0.5秒 fast_sleep_interval = 0.01 # 抢购5秒内倒计时轮询时间,默认0.01秒 # 配置【预约抢购,自动加入购物车】 is_pass_cart = True # 是否跳过添加购物车,默认True # 配置【预约抢购,不会自动加入购物车】 # area = '19_1607_3155_62117' # 区域id # sku_buy_time = '2020-12-04 15:00:00.000' # 商品抢购时间 # buy_time = None # 开始抢购时间,默认为None,自动提前0.050秒,网络通畅时不需要修改,如果网络慢可根据自己情况适当修改,格式:'2020-11-28 12:59:59.950' # fast_mode = True # 快速模式:略过访问抢购订单结算页面这一步骤,默认为 True asst = Assistant() # 初始化 asst.login_by_QRcode() # 扫码登陆 # 执行【预约抢购,自动加入购物车】 一定要确保预约的商品在购物车中才能使用这种方式!!!否则只能用其他方式 asst.exec_reserve_seckill_by_time(sku_id=sku_id, buy_time=buy_time, retry=retry, interval=interval, num=num, is_pass_cart=is_pass_cart, sleep_interval=sleep_interval, fast_sleep_interval=fast_sleep_interval) # 执行【预约抢购,不会自动加入购物车】 # asst.exec_seckill_by_time(sku_ids=sku_id, buy_time=buy_time, sku_buy_time=sku_buy_time, retry=retry, interval=interval, num=num, fast_mode=fast_mode, sleep_interval=sleep_interval, fast_sleep_interval=fast_sleep_interval)
# -*- coding:utf-8 -*- from datetime import datetime from jd_assistant import Assistant from timer import Timer if __name__ == '__main__': """ 重要提示:此处为示例代码之一,请移步下面的链接查看使用教程👇 https://github.com/tychxn/jd-assistant/wiki/1.-%E4%BA%AC%E4%B8%9C%E6%8A%A2%E8%B4%AD%E5%8A%A9%E6%89%8B%E7%94%A8%E6%B3%95 """ sku_ids = '' # 商品id area = '4_50953_58487' # 区域id buy_time = '' asst = Assistant() # 初始化 asst.login_by_QRcode() # 扫码登陆 #asst.clear_cart() # 清空购物车(可选) x = int(input('预约请安1,抢购请按2:')) sku_ids = input('请输入商品编号:') buy_time = input('请输入抢购预约时间(如2018-09-28 22:45:50.000):') time1 = datetime.now().strftime('%Y-%m-%d ') if len(buy_time) == 12 : buy_time = time1 + buy_time if x == 1: asst.make_reserve(sku_id=sku_ids, buy_time=buy_time) # """商品预约 # :param sku_id: 商品id # :return: # """
#!/usr/bin/env python # -*- coding:utf-8 -*- from jd_assistant import Assistant import random if __name__ == '__main__': """ 重要提示:此处为示例代码之一,请移步下面的链接查看使用教程👇 https://github.com/tychxn/jd-assistant/wiki/1.-%E4%BA%AC%E4%B8%9C%E6%8A%A2%E8%B4%AD%E5%8A%A9%E6%89%8B%E7%94%A8%E6%B3%95 """ # area = '19_1607_4773' # 区域id asst = Assistant() # 初始化 asst.login_by_QRcode() # 扫码登陆 # asst.get_single_item_stock(100006394713,1,'19_1607_4773') # 获取参数信息 model_type = input("请输入购买类型(1.定时预约抢购 2.正常有货购买 3.正常定时购买):") if model_type == '1': print("定时预约抢购...") sku_id = input("请输入一个sku_id:") asst.print_item_info(sku_id) reserve_info = asst.get_reserve_info(sku_id) reserve_time = reserve_info.get("yueStime") buy_time = reserve_info.get("qiangStime") print("预约时间:", reserve_time) print("抢购时间:", buy_time) # 开始预约 if reserve_time: asst.make_reserve(sku_id, reserve_time + '.000') else: print('获取预约时间失败') # 开始抢购
#!/usr/bin/env python # -*- coding:utf-8 -*- from jd_assistant import Assistant if __name__ == '__main__': asst = Assistant() # 初始化 asst.login_by_QRcode() # 扫码登陆 asst.make_reserve(sku_id='100011521400', buy_time='2020-03-09 21:00:00.100') asst.make_reserve(sku_id='100011551632', buy_time='2020-03-10 15:00:00.100') asst.make_reserve(sku_id='100006394713', buy_time='2020-03-10 15:00:00.100') # 执行预约抢购 # 2个参数 # sku_id: 商品id # buy_time: 预约时间,例如:'2019-11-10 22:41:30.000'
#!/usr/bin/env python # -*- coding:utf-8 -*- from jd_assistant import Assistant if __name__ == '__main__': asst = Assistant() asst.login_by_username() # asst.login_by_QRcode() print(asst.get_item_stock_state(sku_id='5089267', area='12_904_3375')) print(asst.get_item_price(sku_id='5089267')) asst.clear_cart() asst.add_item_to_cart(sku_id='5089267') asst.get_cart_detail() asst.get_checkout_page_detail() print(asst.get_user_info()) # asst.submit_order() asst.get_order_info(unpaid=False)
#!/usr/bin/env python # -*- coding:utf-8 -*- from jd_assistant import Assistant if __name__ == '__main__': """ 重要提示:此处为示例代码之一,请移步下面的链接查看使用教程👇 https://github.com/tychxn/jd-assistant/wiki/1.-%E4%BA%AC%E4%B8%9C%E6%8A%A2%E8%B4%AD%E5%8A%A9%E6%89%8B%E7%94%A8%E6%B3%95 """ asst = Assistant() # 初始化 asst.login_by_QRcode() # 扫码登陆 # asst.clear_cart() asst.exec_seckill_by_time(sku_ids="100011351650", buy_time="2020-03-10 10:00:00.000", retry=20, interval=0.080) # asst.exec_seckill_by_time(sku_ids="100011551632,100006394713",buy_time = "2020-03-09 20:00:00.000", retry = 20, interval = 0.030) # 执行预约抢购 # 5个参数 # sku_id: 商品id # buy_time: 下单时间,例如:'2019-11-10 22:41:30.000' # retry: 抢购重复执行次数,可选参数,默认4次 # interval: 抢购执行间隔,可选参数,默认4秒 # num: 购买数量,可选参数,默认1个
#!/usr/bin/env python # -*- coding:utf-8 -*- from jd_assistant import Assistant if __name__ == '__main__': """ 启动前请先【安装chrome】并下载【与内核版本相同的chromedriver】,然后在config.ini中配置chromedriver_path 如果需要指定chrome路径,则需要配置chrome_path chromedriver下载:https://sites.google.com/a/chromium.org/chromedriver/home """ asst = Assistant(True) # 初始化 if asst.use_new: asst.login_by_browser() else: asst.login_by_QRcode() # 扫码登陆 asst.start_by_config() # 根据商品是否有货自动下单 # 6个参数: # sku_ids: 商品id。可以设置多个商品,也可以带数量,如:'1234' 或 '1234,5678' 或 '1234:2' 或 '1234:2,5678:3' # area: 地区id # wait_all: 是否等所有商品都有货才一起下单,可选参数,默认False # stock_interval: 查询库存时间间隔,可选参数,默认3秒 # submit_retry: 提交订单失败后重试次数,可选参数,默认3次 # submit_interval: 提交订单失败后重试时间间隔,可选参数,默认5秒