Esempio n. 1
0
async def ldbot():
    browser = await connect(browserWSEndpoint=ws_url)
    page = await browser.newPage()
    await page._client.send('Emulation.clearDeviceMetricsOverride')

    while True:
        for link in links:
            print(datetime.now())

            stock = await get_stock(page, link)
            print(stock)
            if stock != "Out of Stock" and stock != "Store Pickup Only" and stock != None:
                beepy.beep()

                await page.waitForSelector('#add-to-cart')
                await page.click('#add-to-cart')

                await asyncio.sleep(3)

                await page.goto('https://www.londondrugs.com/cart/')

                # checkout btn
                await page.click(
                    '#cart-items-form > fieldset > div > div.shopping-cart__order-processing > div > div.cart-total__payment-section > fieldset > button'
                )

                await asyncio.sleep(3)

                # review billing
                await page.click(
                    '#dwfrm_singleshipping_shippingAddress > button')

                await page.waitForXPath(cvv_xpath)

                # type cvv
                cvv_field = await page.xpath(cvv_xpath)
                await cvv_field[0].type('5155')

                await asyncio.sleep(3)

                # review order
                await page.click('#dwfrm_billing > button')

                await page.waitForXPath(tick_xpath)
                tickbox = await page.xpath(tick_xpath)
                await tickbox[0].click()

                # place order
                await page.click(
                    'body > main > div > div > div > section > form > '
                    'div.ch-place-order-confirm > div.ch-place-order__action-button-bottom > button'
                )

                await asyncio.sleep(5)

                telegram_send("LD Checkout")
            else:
                print("Not in stock :(")
                await asyncio.sleep(5)
            await asyncio.sleep(15)
Esempio n. 2
0
def amd():
    print(datetime.now())
    threading.Timer(30.0, amd).start()

    r = session.get(link)

    if oos not in str(r.content) and na not in str(r.content):
        webbrowser.open(link)
        telegram_send(link)
Esempio n. 3
0
def ts():
    print(datetime.now())
    threading.Timer(60.0, ts).start()

    for link in links:
        r = requests.get(link)

        sc = r.status_code
        print(sc)

        if sc not in scs:
            telegram_send(link)
            webbrowser.open(link)
Esempio n. 4
0
def st():
    print(datetime.now())
    threading.Timer(60.0, st).start()

    for link in links:
        r = requests.get(link)

        sc = r.status_code
        print(sc)
        if sc != 404 and sc != 500:
            telegram_send(link)
            webbrowser.open(link)
            webbrowser.open(cart)
Esempio n. 5
0
async def costco():
    browser = await connect(browserWSEndpoint=ws_url)
    page = await browser.newPage()
    await page._client.send('Emulation.clearDeviceMetricsOverride')

    while True:
        for url in urls:
            print(datetime.now())
            await page.goto(url)
            a2c_txt = await page.evaluate(
                'document.querySelector("#add-to-cart-btn").getAttribute("value")'
            )
            if a2c_txt != "Out of Stock" and url not in already_bought:
                # beepy.beep()
                print("In Stock!")
                telegram_send(url)
                already_bought.append(url)

                await page.evaluate(
                    'document.querySelector("#add-to-cart-btn").click()')
                await page.waitForResponse(
                    'https://www.costco.ca/AjaxManageShoppingCartCmd')

                await page.goto(cart)

                await page.evaluate(co_js)
                await page.waitForNavigation()

                # await page.waitForSelector(iframe)
                # frame_element = await page.querySelector(iframe)
                # frame = await frame_element.contentFrame()
                # print("Inside CVV IFrame")
                # await page.waitForSelector(cvv)
                # await page.click(cvv)
                # await page.type(cvv, '844')
                # print("CVV Typed")

                await page.focus(promo_field)
                await page.type(promo_field, promo)

                telegram_send("Type CVV!")

                await asyncio.sleep(30)

                await page.waitForSelector(place_order)
                await page.click(place_order)
            else:
                print("Not in stock :(")
                await asyncio.sleep(5)
        await asyncio.sleep(5)
Esempio n. 6
0
async def buy(page, sku):
    print("Success!")
    print(sku)
    url = base_url + sku
    telegram_send(url)
    await page.goto(url)

    if "blocked" in page.url:
        print('captcha')
        await page.waitForNavigation()
    print('prod page')


    navigationPromise = asyncio.ensure_future(page.waitForSelector(a2c_selector))
    await page.click(a2c_selector)
    await navigationPromise  # wait until navigation finishes

    await page.goto(checkout)
    await page.waitForNavigation()

    # gc logic to be fixed
    # if gcs != []:
    #     num = gcs[0][0]
    #     pin = gcs[0][1]
    #     # check if edit payment exists
    #     select = await page.xpath(select_payment_xpath)
    #     if select != []:
    #         print("click on edit payment")
    #         await page.click(select[0])
    #
    #     print("type gc")
    #     # type gc number and pin
    #     await page.type('#cardNumber', num)
    #     await page.type('#cardPin', pin)
    #     # pay with gc
    #     await page.click('#step3 > div.css-10nwg10.e1vdg7k72 > div.css-k008qs.e11c4i080 > div.css-1rr4qq7.e11c4i081 > div:nth-child(3) > button > div')
    #
    #     # apply gc
    #     await page.click('#payments_add_gift_card > div.css-1bnvp8n.e1f06pdh3 > button')
    #
    #     # wait for gc to be applied
    #     await page.waitForSelector(gc_apply_more_selector)
    #     print("gc applied")
    #     gcs.pop(0)
    #     print(gcs)

    # click on place order
    await page.click('body > div.js-content > div > div > div.css-1yml32t.e9pe5pm0 > div.css-1pv5w2k.edp9pj60 > div > div > div > button')
Esempio n. 7
0
def eb():
    print(datetime.now())
    threading.Timer(15.0, eb).start()

    for link in links:
        r = session.get(link)
        if r.status_code != 302 and r.url != 'https://www.gamestop.ca/Home/Index':
            oos_button = r.html.find("#btnAddToCart", first=True)
            no_show = "display:none;"
            if oos_button.attrs["style"] != no_show:
                beepy.beep()
                try:
                    sku = r.html.find('.productSelected',
                                      first=True).attrs['name'][-6:]
                    print(sku)
                except:
                    print("Get SKU Error!")
                telegram_send(link)
                webbrowser.open(link)
Esempio n. 8
0
def nebot():
    print(datetime.now())
    threading.Timer(15.0, nebot).start()

    for link in links:
        r = session.get(link)
        item_containers = r.html.find(".item-container")

        for item in item_containers:
            btn_text = item.find(".btn-mini", first=True).full_text
            if btn_text != "Sold Out" and btn_text != "Auto Notify ":
                # beepy.beep(sound="coin")
                item_url = item.find('a')[0].attrs['href']
                if item_url not in url_list and "3070" not in item_url:
                    url_list.append(item_url)
                    telegram_send(item_url)
                    webbrowser.open(item_url)
                    telegram_send(cart)
                    print(item_url)
Esempio n. 9
0
async def tru():
    browser = await connect(browserWSEndpoint=ws_url)

    while True:
        print(datetime.now())
        for sku in skus:
            stock = stock_base.format(sku)
            store = store_base.format(sku)
            r = requests.get(stock)

            j = r.json()
            stock = j['ats']['homeDelivery']

            if stock != 0:
                telegram_send(store)
                telegram_send(str(stock))

                page = await browser.newPage()
                await page._client.send('Emulation.clearDeviceMetricsOverride')

                await page.goto(store)
                # await page.type(amount, str(stock))

                await page.click(a2c)

                await asyncio.sleep(2)

                await page.goto(pymts)

                await page.waitForSelector(cvvfield)
                await page.type(cvvfield, '844')

                await page.click(review)
                await page.waitForSelector(place_order)
                await page.click(place_order)
            else:
                print("Not in stock :(")
        await asyncio.sleep(15)
Esempio n. 10
0
def check_3060():
    print(datetime.now())
    threading.Timer(15.0, check_3060).start()

    r = requests.get(check_stock_exists)
    j = r.json()
    p = j["searchedProducts"]["productDetails"]
    for item in p:
        name = item["displayName"]
        print(name)
        if "3060" in name:
            print(item)
            id = item['digitialRiverID']
            if id != '':
                print(id)
                telegram_send(id)
                beepy.beep()
                a2c_link = a2c.format(id)
                webbrowser.open(a2c_link)
                webbrowser.open(cart)
                telegram_send(a2c_link)
                telegram_send(cart)
                break
Esempio n. 11
0
                                shuffle=False,
                                num_workers=4,
                                collate_fn=pad)

    optimizer = optim.Adam(model.parameters(), lr=hp.lr)
    criterion = nn.CrossEntropyLoss(ignore_index=0)

    for epoch in range(1, hp.n_epochs + 1):
        train(model, train_iter, optimizer, criterion)

        print(f"=========eval at epoch={epoch}=========")
        if not os.path.exists(hp.logdir): os.makedirs(hp.logdir)
        fname = os.path.join(hp.logdir, str(epoch))
        precision, recall, f1 = eval(model, eval_iter, fname)

        telegram_send('[epoch={}]'.format(epoch))
        telegram_send_measure('dev trigger classification', precision, recall,
                              f1)
        precision, recall, f1 = eval(model,
                                     eval_iter,
                                     fname,
                                     identification=True)
        telegram_send_measure('dev trigger identification', precision, recall,
                              f1)

        torch.save(model.state_dict(), f"{fname}.pt")
        print(f"weights were saved to {fname}.pt")

        print(f"test eval")
        precision, recall, f1 = eval(model, test_iter, fname)
        telegram_send_measure('test trigger classification', precision, recall,
Esempio n. 12
0
def logs_error(message):
    print(message)
    telegram_send(message)