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个
#!/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元----付款方式:在线支付 """
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)
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/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秒