Ejemplo n.º 1
0
def main():
    logging.basicConfig(format="%(levelname)s: %(asctime)s - %(message)s",
                        datefmt="%I:%M:%S",
                        level=logging.INFO)
    settings = util.load_settings()
    item = settings["item"]
    personal_info = settings["personalInfo"]

    bot = Bot("https://www.nike.com/launch?s=in-stock")
    bot.go_to_start_page()
    start_time = time.time()
    if bot.select_shoe(item["shoePosition"]) and bot.select_shoe_size(
            item["sizePosition"]):
        if bot.add_to_cart():
            time.sleep(1)
            if bot.go_to_checkout():
                if bot.log_in(personal_info["email"],
                              personal_info["password"]):
                    bot.wait_till_on_checkout_page()
                    bot.fill_in_cvv(personal_info["cvv"])
    logging.info(f"Total time: {time.time() - start_time}s.")
Ejemplo n.º 2
0
                  flash_sale_start.strftime("%H:%M:%S"))
            print(INFO, "Menunggu Flash Sale...", end='\r')
            sleep(
                (datetime.fromtimestamp(item.upcoming_flash_sale.start_time) -
                 datetime.now()).total_seconds() - 2)
            print(INFO, "Bersiap siap...", end='\r')
            while not item.is_flash_sale:
                item = bot.fetch_item(item.item_id, item.shop_id)
        else:
            print(PROMPT, "Flash Sale telah Lewat!")
            exit(1)

    print(INFO, "Flash Sale telah tiba")
    start = datetime.now()
    print(INFO, "Menambah item ke cart...")
    cart_item = bot.add_to_cart(item, selected_model)
    print(INFO, "Checkout item...")
    bot.checkout(selected_payment_channel, selected_option_info, cart_item)
    end = datetime.now() - start
    print(INFO, "Item berhasil dibeli dalam waktu", Fore.YELLOW, end.seconds,
          "detik", end.microseconds // 1000, "milis")
    print(Fore.GREEN + "[*]", "Sukses")
except JustAnException as e:
    print(
        ERROR, {
            0x90b109: "url tidak cocok",
            0x69: "item tidak ditemukan",
            0x2323: "stok habis",
            0xb612: "gagal menambah item ke cart",
            0x1111: "gagal mengambil info checkout",
            0xaaaa: "gagal checkout",