-
-
Save demarcusw/4e429b29a8b47f0f8c0bed4391fa0cc6 to your computer and use it in GitHub Desktop.
Revisions
-
jef revised this gist
Sep 18, 2020 . No changes.There are no files selected for viewing
-
jef revised this gist
Sep 18, 2020 . 1 changed file with 7 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -30,6 +30,7 @@ async function buy() { const links = [ "https://www.nvidia.com/en-us/geforce/buy/", "https://www.nvidia.com/en-us/shop/geforce/?page=1&limit=9&locale=en-us&search=3080", "https://www.bestbuy.com/site/nvidia-geforce-rtx-3080-10gb-gddr6x-pci-express-4-0-graphics-card-titanium-and-black/6429440.p?skuId=6429440", ]; for (const link of links) { await goto(link); @@ -41,6 +42,11 @@ async function buy() { async function goto(link) { const browser = await puppeteer.launch(); const page = await browser.newPage(); await page.setUserAgent( "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36" ); page.setViewport({ width: 1920, height: 1080, @@ -57,7 +63,7 @@ async function goto(link) { console.log(dom); if (dom.body.toLowerCase().includes("out of stock") || dom.body.toLowerCase().includes("sold out")) { console.log("still out of stock, will try again."); } else { console.log("*** IN STOCK, BUY NOW ***"); -
jef revised this gist
Sep 17, 2020 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,6 +3,7 @@ const opn = require("opn"); const nodemailer = require("nodemailer"); const timeout = 5000; const waitForTimeout = 1000; const cartLink = "https://store.nvidia.com/store/nvidia/en_US/buy/productID.5438481700/clearCart.yes/nextPage.QuickBuyCartPage"; @@ -46,7 +47,7 @@ async function goto(link) { }); await page.goto(link); await page.waitFor(waitForTimeout); const dom = await page.evaluate(() => { return { -
jef revised this gist
Sep 17, 2020 . No changes.There are no files selected for viewing
-
jef revised this gist
Sep 17, 2020 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -77,7 +77,7 @@ async function goto(link) { } try { buy(); } catch (error) { buy(); } -
jef revised this gist
Sep 17, 2020 . 1 changed file with 4 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,6 +2,8 @@ const puppeteer = require("puppeteer"); const opn = require("opn"); const nodemailer = require("nodemailer"); const timeout = 5000; const cartLink = "https://store.nvidia.com/store/nvidia/en_US/buy/productID.5438481700/clearCart.yes/nextPage.QuickBuyCartPage"; @@ -23,8 +25,6 @@ const mailOptions = { text: cartLink, }; async function buy() { const links = [ "https://www.nvidia.com/en-us/geforce/buy/", @@ -77,7 +77,7 @@ async function goto(link) { } try { buy() } catch (error) { buy() } -
jef revised this gist
Sep 17, 2020 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -77,7 +77,7 @@ async function goto(link) { } try { buy(); } catch (error) { buy(); } -
jef revised this gist
Sep 17, 2020 . 1 changed file with 26 additions and 20 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,30 +1,34 @@ const puppeteer = require("puppeteer"); const opn = require("opn"); const nodemailer = require("nodemailer"); const cartLink = "https://store.nvidia.com/store/nvidia/en_US/buy/productID.5438481700/clearCart.yes/nextPage.QuickBuyCartPage"; const emailUsername = process.env.EMAIL_USERNAME; const emailPassword = process.env.EMAIL_PASSWORD; const transporter = nodemailer.createTransport({ service: "gmail", auth: { user: emailUsername, pass: emailPassword, }, }); const mailOptions = { from: emailUsername, to: emailUsername, subject: "NVIDIA - BUY NOW", text: cartLink, }; const timeout = 5000; async function buy() { const links = [ "https://www.nvidia.com/en-us/geforce/buy/", "https://www.nvidia.com/en-us/shop/geforce/?page=1&limit=9&locale=en-us&search=3080", ]; for (const link of links) { await goto(link); @@ -58,20 +62,22 @@ async function goto(link) { console.log("*** IN STOCK, BUY NOW ***"); await page.screenshot({ path: `nvidia-${Date.now()}.png` }); opn(cartLink); if (emailUsername && emailPassword) { transporter.sendMail(mailOptions, function (error, info) { if (error) { console.log(error); } else { console.log("email sent: " + info.response); } }); } } await browser.close(); } try { buy().then(); } catch (error) { buy().then(); } -
jef revised this gist
Sep 17, 2020 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -15,7 +15,7 @@ const transporter = nodemailer.createTransport({ const mailOptions = { from: '[email protected]', to: '[email protected]', subject: 'NVIDIA - BUY NOW', text: cartLink }; -
jef revised this gist
Sep 17, 2020 . 1 changed file with 5 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -70,4 +70,8 @@ async function goto(link) { await browser.close(); } try { buy().then(); } catch(error) { buy().then(); } -
jef revised this gist
Sep 17, 2020 . 1 changed file with 26 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,23 @@ const puppeteer = require("puppeteer"); const opn = require("opn"); const nodemailer = require('nodemailer'); const cartLink = "https://store.nvidia.com/store/nvidia/en_US/buy/productID.5438481700/clearCart.yes/nextPage.QuickBuyCartPage" const transporter = nodemailer.createTransport({ service: 'gmail', auth: { user: '[email protected]', pass: 'password' } }); const mailOptions = { from: '[email protected]', to: '[email protected]', subject: 'NVIDIA, BUY NOW', text: cartLink }; const timeout = 5000; @@ -39,7 +57,14 @@ async function goto(link) { } else { console.log("*** IN STOCK, BUY NOW ***"); await page.screenshot({ path: `nvidia-${Date.now()}.png` }); opn(cartLink); transporter.sendMail(mailOptions, function(error, info){ if (error) { console.log(error); } else { console.log('Email sent: ' + info.response); } }); } await browser.close(); -
jef revised this gist
Sep 17, 2020 . 1 changed file with 0 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,7 +5,6 @@ const timeout = 5000; async function buy() { const links = [ "https://www.nvidia.com/en-us/geforce/buy/", "https://www.nvidia.com/en-us/shop/geforce/?page=1&limit=9&locale=en-us&search=3080" ]; -
jef revised this gist
Sep 17, 2020 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,6 +5,7 @@ const timeout = 5000; async function buy() { const links = [ "https://store.nvidia.com/store/nvidia/en_US/buy/productID.5438481700/clearCart.yes/nextPage.QuickBuyCartPage", "https://www.nvidia.com/en-us/geforce/buy/", "https://www.nvidia.com/en-us/shop/geforce/?page=1&limit=9&locale=en-us&search=3080" ]; -
jef revised this gist
Sep 17, 2020 . 1 changed file with 0 additions and 47 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -15,47 +15,6 @@ async function buy() { setTimeout(buy, timeout); } async function goto(link) { const browser = await puppeteer.launch(); const page = await browser.newPage(); @@ -86,10 +45,4 @@ async function goto(link) { await browser.close(); } buy().then(); -
jef revised this gist
Sep 17, 2020 . 1 changed file with 48 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -39,7 +39,54 @@ async function goto(link) { } else { console.log("*** IN STOCK, BUY NOW ***"); await page.screenshot({ path: `nvidia-${Date.now()}.png` }); opn(const puppeteer = require("puppeteer"); const opn = require("opn"); const timeout = 5000; async function buy() { const links = [ "https://www.nvidia.com/en-us/geforce/buy/", "https://www.nvidia.com/en-us/shop/geforce/?page=1&limit=9&locale=en-us&search=3080" ]; for (const link of links) { await goto(link); } setTimeout(buy, timeout); } async function goto(link) { const browser = await puppeteer.launch(); const page = await browser.newPage(); page.setViewport({ width: 1920, height: 1080, }); await page.goto(link); await page.waitFor(1000); const dom = await page.evaluate(() => { return { body: document.body.innerText, }; }); console.log(dom); if (dom.body.toLowerCase().includes("out of stock")) { console.log("still out of stock, will try again."); } else { console.log("*** IN STOCK, BUY NOW ***"); await page.screenshot({ path: `nvidia-${Date.now()}.png` }); opn("https://store.nvidia.com/store/nvidia/en_US/buy/productID.5438481700/clearCart.yes/nextPage.QuickBuyCartPage"); } await browser.close(); } buy().then();); } await browser.close(); -
jef revised this gist
Sep 17, 2020 . 1 changed file with 1 addition and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -6,8 +6,7 @@ const timeout = 5000; async function buy() { const links = [ "https://www.nvidia.com/en-us/geforce/buy/", "https://www.nvidia.com/en-us/shop/geforce/?page=1&limit=9&locale=en-us&search=3080" ]; for (const link of links) { await goto(link); -
jef revised this gist
Sep 17, 2020 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -46,4 +46,4 @@ async function goto(link) { await browser.close(); } buy().then(); -
jef revised this gist
Sep 17, 2020 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -39,10 +39,10 @@ async function goto(link) { console.log("still out of stock, will try again."); } else { console.log("*** IN STOCK, BUY NOW ***"); await page.screenshot({ path: `nvidia-${Date.now()}.png` }); opn(link); } await browser.close(); } -
jef revised this gist
Sep 17, 2020 . No changes.There are no files selected for viewing
-
jef created this gist
Sep 17, 2020 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,49 @@ const puppeteer = require("puppeteer"); const opn = require("opn"); const timeout = 5000; async function buy() { const links = [ "https://www.nvidia.com/en-us/geforce/buy/", "https://www.nvidia.com/en-us/shop/geforce/?page=1&limit=9&locale=en-us&search=3080", "https://t.co/jm0rrgxkDl?amp=1" ]; for (const link of links) { await goto(link); } setTimeout(buy, timeout); } async function goto(link) { const browser = await puppeteer.launch(); const page = await browser.newPage(); page.setViewport({ width: 1920, height: 1080, }); await page.goto(link); await page.waitFor(1000); const dom = await page.evaluate(() => { return { body: document.body.innerText, }; }); console.log(dom); if (dom.body.toLowerCase().includes("out of stock")) { console.log("still out of stock, will try again."); } else { console.log("*** IN STOCK, BUY NOW ***"); opn(link); } await page.screenshot({ path: `nvidia-${Date.now()}.png` }); await browser.close(); } buy().then();