Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hangs after launching chromium #15

Open
dziban303 opened this issue Jul 5, 2018 · 14 comments
Open

Hangs after launching chromium #15

dziban303 opened this issue Jul 5, 2018 · 14 comments

Comments

@dziban303
Copy link

After launching the script, it asks for Amazon username and password, then launches chromium. At that point, nothing else happens. It doesn't open anything in chromium.

2018-07-05_15-51-36

Meanwhile, python.exe consumes a CPU core.
2018-07-05_15-51-59

Stopping the process yields the following:
cmd_2018-07-05_15-58-27

Any ideas?

@sniffingpickles
Copy link

You have to install 3.6.6, looks like you installed latest 3.7:

https://www.python.org/downloads/release/python-366/

@dziban303
Copy link
Author

dziban303 commented Jul 9, 2018

Doh. Forgot to fix the PATH variable. Thanks, now the script it running. It went through a few giveaways, then crashed.
cmd_2018-07-09_18-01-09

@sniffingpickles
Copy link

It's unable to grab the next page URL; I'm working on fix for that right now (shhh dont' tell @zdrouse )

@dziban303
Copy link
Author

That would be great if you could fix it. It's a bit beyond me, I'm afraid.

It'd be nice if it would accept username and password as command line variables, or store them in a cfg file.

@sniffingpickles
Copy link

This is my 2nd time ever messing around with python, honestly. I normally outsource it.

But i'm almost positive the xpath is incorrect (maybe something updated in the recent months), and it doesn't know how to use the "navigate to" function in that iteration function.

Lastly, I'm pretty sure we can just save the variables somewhere. I'll look at making a config line

@sniffingpickles
Copy link

So, to make it so you don't have to type login over and over, go to like 47/48 on giveaway.py

image

@sniffingpickles
Copy link

Updated and fixed the loop problem:

https://github.com/sniffingpickles/Auto-Amazon-Giveaways

@dziban303
Copy link
Author

Works for a bit, and then:

cmd_2018-07-10_13-00-18

@sniffingpickles
Copy link

sniffingpickles commented Jul 10, 2018

I haven't figured out why pyppeteer likes to get hungup on tabs opening/closing

So i made a quick "ghetto" fix:

Create a file called "loop.py" (in same directory as give_it_away_now.py)

put this in it:

from subprocess import Popen
import sys
 
filename = sys.argv[1]
while True:
    print("\nStarting " + filename)
    p = Popen("python " + filename, shell=True)
    p.wait()

Now start giveaway bot with

python loop.py "give_it_away_now.py"

Basically this is a way to make sure the process restarts. I'm working on a way to log the last page it gets "stuck" on, so if it restarts, it just continues.

@dziban303
Copy link
Author

There are a lot of pages, right? So upon restart, what about creating a random number in loop.py and starting at that page? That would ensure it's not doing the same 20 giveaways over and over.

@sniffingpickles
Copy link

Sure,

Add this to the top of the page:

Line: 13
RANDOM_PAGE = [3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]
Add more numbers if you'd like

Then change the giveaway url string to (on line 23'ish, can't say since mine is edited a lot)
await login_page.goto('https://www.amazon.com/ga/giveaways?pageId=' + str(numpy.random.choice(RANDOM_PAGE)))

@dziban303
Copy link
Author

I see you added support for YT videos on your fork. Since the tab doesn't have to be in the foreground for the 30s timer to work, could the bot move on to the next giveaway and come back to the video giveaway tab afterwards? That way the bot won't get stuck only doing 2 giveaways per minute.

It's actually less than 2 per minute, because the bot's 30 second timer only starts several seconds after the tab is opened; the Continue button activates well before the bot clicks it.

Anyway you've got the "Issues" section disabled on your fork, you might consider turning it on (in repository settings).

Thanks for everything!

@sniffingpickles
Copy link

I've actually rebuilt a ton of features, just struggling time to upload them.

If you multi-thread the chrome process, it times out often. I tried :(

I added all video support, a database for remembering giveaways visited, and everytype of giveaway completed. I do the amazon video type by injecting javascript into the page lol

@sniffingpickles
Copy link

updated my repo, added the features above, and enabled issues tracker

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants