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) # 执行抢购
#!/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个
#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: # """ elif x == 2: asst.exec_seckill_by_time(sku_ids=sku_ids, buy_time=buy_time) # """定时抢购 # :param sku_ids: 商品id,多个商品id用逗号进行分割,如"123,456,789" # :param buy_time: 下单时间,例如:'2018-09-28 22:45:50.000' # :param retry: 抢购重复执行次数,可选参数,默认4次 # :param interval: 抢购执行间隔,可选参数,默认4秒 # :param num: 购买数量,可选参数,默认1个 # :return: # """ elif x == 3: asst.exec_reserve_seckill_by_time(sku_id=sku_ids, buy_time=buy_time) # 执行预约抢购 # 5个参数 # 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__': """ 重要提示:此处为示例代码之一,请移步下面的链接查看使用教程👇 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秒
#!/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个
重要提示:此处为示例代码之一,请移步下面的链接查看使用教程👇 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' # 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次
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, buy_time=buy_time, retry=15, interval=0.2, num=1) elif model_type == '2': print("正常有货购买...") sku_ids = input("请输入一个或多个sku_id:") area = input("请输入area_id:") asst.buy_item_in_stock(sku_ids=sku_ids, area=area, wait_all=False, stock_interval=5) elif model_type == '3': print("正常定时购买...") sku_ids = input("请输入一个或多个sku_id:") buy_time = input("请输入定时购买时间(2020-03-04 00:59:59.000):") asst.clear_cart() # 清空购物车(可选)
if reserve_time: asst.make_reserve(sku_id, reserve_time + '.000') else: print('获取预约时间失败') # 开始抢购 if buy_time is not None: rand_msecond = random.randint(1, 9) * 1000 # buy_time = buy_time + '.000' # buy_time = buy_time #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) if toTimeStamp(buy_time) - time.time() > 100: asst.exec_seckill_by_time( sku_ids=sku_id, buy_time=buy_time, retry=retry, interval=loopinterval, num=1) else: logger.info("已过时:buy_time:%s now:%s"%(buy_time,datetime.datetime.now())) elif model_type == '2': print("正常有货购买...") if not sku_id: sku_id = input("请输入一个或多个sku_id:") if not area: area = input("请输入area_id:") asst.buy_item_in_stock(sku_ids=sku_id, area=area, wait_all=False, stock_interval=5) elif model_type == '3': print("正常定时购买...") sku_ids = input("请输入一个或多个sku_id:") buy_time = input("请输入定时购买时间(2020-03-04 00:59:59.000):")
#!/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="100011385146", buy_time="2020-02-16 20:00:00.085") # 酒精 asst.exec_seckill_by_time(sku_ids="100011551632", buy_time="2020-02-26 20:00:00.000") # 执行预约抢购 # 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 """ asst = Assistant() # 初始化 asst.login_by_QRcode() # 扫码登陆 #asst.clear_cart() asst.exec_seckill_by_time(sku_ids="100011385146", buy_time="2020-02-17 20:00:00.800") # 执行预约抢购 # 5个参数 # sku_id: 商品id # buy_time: 下单时间,例如:'2019-11-10 22:41:30.000' # retry: 抢购重复执行次数,可选参数,默认4次 # interval: 抢购执行间隔,可选参数,默认4秒 # num: 购买数量,可选参数,默认1个