Giter Club home page Giter Club logo

Comments (12)

jpchip avatar jpchip commented on July 17, 2024

When you start the script, a new chrome instance/window should open where everything happens.

from giveaway-grabber.

famewolf avatar famewolf commented on July 17, 2024

from giveaway-grabber.

jpchip avatar jpchip commented on July 17, 2024

Ah yeah, you'll have to tweak the code slightly to give you time to enter your code. In index.js, something like:

//sign in
await signIn(page, username, password);

//wait here until user submits two factor auth code
const twoFactorAuthPromise = page.waitForNavigation();
await twoFactorAuthPromise;

//go to giveaways

I haven't tried that, but I'm pretty sure that would do it.

from giveaway-grabber.

famewolf avatar famewolf commented on July 17, 2024

Tried the code...it sat on the giveaway page....terminal showed:

famewolf@hp810-135qe ~/giveaway-grabber $ npm start

[email protected] start /home/famewolf/giveaway-grabber
node index.js

Page 1 Start:
giveaway 1 did not exist?
giveaway 2 did not exist?
giveaway 3 did not exist?
giveaway 4 did not exist?
giveaway 5 did not exist?
giveaway 6 did not exist?
giveaway 7 did not exist?
giveaway 8 did not exist?
giveaway 9 did not exist?
giveaway 10 did not exist?
giveaway 11 did not exist?
giveaway 12 did not exist?
giveaway 13 did not exist?
giveaway 14 did not exist?
giveaway 15 did not exist?
giveaway 16 did not exist?
giveaway 17 did not exist?
giveaway 18 did not exist?
giveaway 19 did not exist?
giveaway 20 did not exist?
giveaway 21 did not exist?
giveaway 22 did not exist?
giveaway 23 did not exist?
giveaway 24 did not exist?
No more pages! Goodbye!

There were plenty there.

     //sign in
    await signIn(page, username, password);

    //wait here until user submits two factor auth code
    const twoFactorAuthPromise = page.waitForNavigation();
    await twoFactorAuthPromise;

    //go to giveaways
    let url = 'https://www.amazon.com/ga/giveaways';
    if (args.page) {

from giveaway-grabber.

jpchip avatar jpchip commented on July 17, 2024

See comment: #15 (comment)

from giveaway-grabber.

jpchip avatar jpchip commented on July 17, 2024

@famewolf Just published fix for #15, give this another try and let me know if you are still have problems.

I should think about adding this change as under a flag so everyone can use two factor auth if they want....

from giveaway-grabber.

famewolf avatar famewolf commented on July 17, 2024

It works however initially it crashed because I took to long to enter the code....the average user is going to need time to grab their phone..open the app..enter their pin and then enter the code so you may need to adjust the delay if you make this a feature. Really nice! You'd also want to check the "Don't ask for 30 days" checkbox on the 2 party screen.

*original error before I tried 2nd time:

[email protected] start /home/famewolf/giveaway-grabber
node index.js

(node:9936) UnhandledPromiseRejectionWarning: TimeoutError: Navigation Timeout Exceeded: 30000ms exceeded
at Promise.then (/home/famewolf/giveaway-grabber/node_modules/puppeteer/lib/FrameManager.js:1276:21)
at
-- ASYNC --
at Frame. (/home/famewolf/giveaway-grabber/node_modules/puppeteer/lib/helper.js:144:27)
at Page.waitForNavigation (/home/famewolf/giveaway-grabber/node_modules/puppeteer/lib/Page.js:644:49)
at Page. (/home/famewolf/giveaway-grabber/node_modules/puppeteer/lib/helper.js:145:23)
at /home/famewolf/giveaway-grabber/index.js:28:40
at
at process._tickCallback (internal/process/next_tick.js:188:7)
(node:9936) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:9936) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

from giveaway-grabber.

jpchip avatar jpchip commented on July 17, 2024

Thanks. I'll create a new ticket for adding this feature. I think you can increase the default timeout like:

 const twoFactorAuthPromise = page.waitForNavigation({ timeout: 60000 }); //60 seconds instead of 30

from giveaway-grabber.

jpchip avatar jpchip commented on July 17, 2024

Just published new release with optional support for two factor authentication (see readme).

from giveaway-grabber.

famewolf avatar famewolf commented on July 17, 2024

Working great "as we speak" although the "npm -- -2fa" is a little awkward. I'll stick it in an alias and be good to go. Thank you!

from giveaway-grabber.

famewolf avatar famewolf commented on July 17, 2024

Have you considered adding these as additional entries to .env vs command line parms?
User=blah
Password=blah
2FA=Yes
KINDLE=No

from giveaway-grabber.

jpchip avatar jpchip commented on July 17, 2024

user and password are already in the .env file, see the .env.example. I guess I could add the 2FA one as well, I was just lazy.

from giveaway-grabber.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.