shine-jayakumar / insta-likecom-bot

Automates likes and comments on an instagram account or tag
MIT License
136 stars 29 forks source link

after deployed on heroku get error #2

Closed bugbounted closed 2 years ago

bugbounted commented 2 years ago

Hi Shine J, I'm trying to deploy this project to heroku , after done with app.json schema as below : { "name": "insta-likecom-bot", "description": "Automates likes and comments on an instagram account or tag", "repository": "https://github.com/elmirarokni/insta-likecom-bot", "buildpacks": [ { "url": "heroku/python" }, { "url": "https://github.com/heroku/heroku-buildpack-chromedriver" }, { "url": "https://github.com/heroku/heroku-buildpack-google-chrome" } ], "env": { "CHROMEDRIVER_PATH": { "description": "DON'T CHANGE 'Chromedriver path' DON'T CHANGE", "value": "/app/.chromedriver/bin/chromedriver", "required": true }, "GOOGLE_CHROME_BIN": { "description": "DON'T CHANGE 'Google Chrome path' DON'T CHANGE", "value": "/app/.apt/usr/bin/google-chrome", "required": true } } }

my dyno runtime error log is : 2022-05-30T10:37:01.754636+00:00 app[api]: Initial release by user elmirarokni@gmail.com 2022-05-30T10:37:02.302430+00:00 app[api]: Release v2 created by user elmirarokni@gmail.com 2022-05-30T10:37:02.302430+00:00 app[api]: Set CHROMEDRIVER_PATH, GOOGLE_CHROME_BIN config vars by user elmirarokni@gmail.com 2022-05-30T10:37:02.937647+00:00 app[api]: Release v3 created by user elmirarokni@gmail.com 2022-05-30T10:37:02.937647+00:00 app[api]: Enable Logplex by user elmirarokni@gmail.com 2022-05-30T10:37:03.000000+00:00 app[api]: Build started by user elmirarokni@gmail.com 2022-05-30T10:38:25.303891+00:00 app[api]: Deploy by user elmirarokni@gmail.com 2022-05-30T10:38:25.303891+00:00 app[api]: Release v4 created by user elmirarokni@gmail.com 2022-05-30T10:38:40.000000+00:00 app[api]: Build succeeded 2022-05-30T10:38:52.194243+00:00 app[api]: Scaled to worker@1:Free by user elmirarokni@gmail.com 2022-05-30T10:39:02.219480+00:00 heroku[worker.1]: Starting process with command python instalikecombot.py postperpet UPryZD3SVizGF9x manotoofficial -br firefox -ps "test" -c mycomments.txt 2022-05-30T10:39:02.832430+00:00 heroku[worker.1]: State changed from starting to up 2022-05-30T10:39:03.195401+00:00 app[worker.1]: 2022-05-30T10:39:03.195417+00:00 app[worker.1]: __ ____ _ 2022-05-30T10:39:03.195417+00:00 app[worker.1]: | | | / | /_\ _| | | | |/ | / / | \/ || )/ | | 2022-05-30T10:39:03.195417+00:00 app[worker.1]: | || .` _ \ | |/ || | | || ' <| | (| () | |\/| |__| | () || |
2022-05-30T10:39:03.195417+00:00 app[worker.1]: |
||\|/ |// \\ |__|||_|__\_/|| || |__/\/ |_|
2022-05-30T10:39:03.195418+00:00 app[worker.1]:
2022-05-30T10:39:03.195418+00:00 app[worker.1]: insta-likecom-bot v.1.4 2022-05-30T10:39:03.195419+00:00 app[worker.1]: Automates likes and comments on an instagram account or tag 2022-05-30T10:39:03.195419+00:00 app[worker.1]: 2022-05-30T10:39:03.195419+00:00 app[worker.1]: Author: Shine Jayakumar 2022-05-30T10:39:03.195419+00:00 app[worker.1]: Github: https://github.com/shine-jayakumar 2022-05-30T10:39:03.195420+00:00 app[worker.1]:
2022-05-30T10:39:03.195431+00:00 app[worker.1]:
2022-05-30T10:39:03.195511+00:00 app[worker.1]: [] => Script started 2022-05-30T10:39:03.195621+00:00 app[worker.1]: [] => Loaded comments from mycomments.txt 2022-05-30T10:39:03.195666+00:00 app[worker.1]: [] => Downloading webdriver for your version of Firefox 2022-05-30T10:39:03.195705+00:00 app[worker.1]: [] => Initializing instagram user 2022-05-30T10:39:04.425421+00:00 app[worker.1]: [*] => Script ended with error : Message: Expected browser binary location, but unable to find binary in default location, no 'moz:firefoxOptions.binary' capability provided, and no binary flag set on the command line 2022-05-30T10:39:04.425441+00:00 app[worker.1]: 2022-05-30T10:39:04.426431+00:00 app[worker.1]: Traceback (most recent call last): 2022-05-30T10:39:04.426434+00:00 app[worker.1]: File "/app/instalikecombot.py", line 211, in 2022-05-30T10:39:04.426639+00:00 app[worker.1]: insta.quit() 2022-05-30T10:39:04.426677+00:00 app[worker.1]: NameError: name 'insta' is not defined. Did you mean: 'Insta'? 2022-05-30T10:39:04.561341+00:00 heroku[worker.1]: Process exited with status 1 2022-05-30T10:39:05.008277+00:00 heroku[worker.1]: State changed from up to crashed

please make changes on code to work fine with heroku buildpacks : https://github.com/heroku/heroku-buildpack-chromedriver https://github.com/heroku/heroku-buildpack-google-chrome

waiting for your response finest regards

shine-jayakumar commented 2 years ago

I went through the log and see that you've included google chrome and webdriver in the app.json, however, in the parameters, you've mentioned -br firefox. Since the script uses webdriver manager which automatically tries to download the driver to the current directory before initiating a browser instance. In your case, however, we need the script to work with the specified chrome webdriver and chrome browser executable found at locations mentioned in app.json

I am adding another branch soon with chrome webdriver manager removed, while configuring the script to read the path from environment variables.

shine-jayakumar commented 2 years ago

Branch -> heroku-hosting-chrome added

This branch is compatible with heroku hosting. This script will read the binary locations from environment variable. The script has been tested on heroku console. Environment variables and buildpacks were set from the Settings tab of the app on Heroku website.

bugbounted commented 2 years ago

hello again shine , Script ended with error : Failed to login. Incorrect username/password, or 2 factor verification is active. but account is newbie & not any probelm at login : my Procfile is : worker: python instalikecombot.py pmtoome SYfyPacx6DTg manotoofficial -ps "follow : @bugbounted" -c mycomments.txt

shine-jayakumar commented 2 years ago

Hi @elmirarokni Good news that your deployment is able to find the webdrivers and chrome browser and script is working as normal.

I also had faced login issues a couple of times. Instagram is known to do that when the login is detected from different/unknown locations. When you login from your computer, Instagram may ask you if you tried to login from a different location; you just have to confirm it. Otherwise, it would block attempts to login even when the password is correct.

Having said that, I had tried your credentials mentioned above on my heroku hosted app and it's working fine. Would recommend you change the password too since it's on public domain.

Running python instalikecombot.py pmtoome SYfyPacx6DTg manotoofficial -ps "follow : @bugbounted" -nc -np 10 -d 3 on ⬢ instalikecombot... up, run.4442 (Free)

     ___ _  _ ___ _____ _      _    ___ _  _____ ___ ___  __  __     ___  ___ _____
    |_ _| \| / __|_   _/_\ ___| |  |_ _| |/ | __/ __/ _ \|  \/  |___| _ )/ _ |_   _|
     | || .` \__ \ | |/ _ |___| |__ | || ' <| _| (_| (_) | |\/| |___| _ | (_) || |
    |___|_|\_|___/ |_/_/ \_\  |____|___|_|\_|___\___\___/|_|  |_|   |___/\___/ |_|

    insta-likecom-bot v.1.4
    Automates likes and comments on an instagram account or tag

    Author: Shine Jayakumar
    Github: https://github.com/shine-jayakumar

[*] => Script started
[*] => Initializing instagram user
[*] => Setting target to: manotoofficial
[*] => Attempting to log in with pmtoome
[*] => Login successful
[*] => Skipping Save Login Info
[*] => Opening target manotoofficial
[open_target]: Attempt - 1
[*] => No. of posts found: 78711
[*] => Number of posts to like: 10
[*] => Liking post: 1
[like]: Attempt - 1
[*] => Moving on to the next post
[*] => Waiting for 3 seconds
[*] => Liking post: 2
[like]: Attempt - 1
[*] => Moving on to the next post
[*] => Waiting for 3 seconds
[*] => Liking post: 3
[like]: Attempt - 1
[*] => Moving on to the next post
[*] => Waiting for 3 seconds
[*] => Liking post: 4
[like]: Attempt - 1
[*] => Moving on to the next post
[*] => Waiting for 3 seconds
[*] => Liking post: 5
[like]: Attempt - 1
[*] => Moving on to the next post
[*] => Waiting for 3 seconds
[*] => Liking post: 6
[like]: Attempt - 1
[*] => Moving on to the next post
[*] => Waiting for 3 seconds
[*] => Liking post: 7
[like]: Attempt - 1
[*] => Moving on to the next post
[*] => Waiting for 3 seconds
[*] => Liking post: 8
[like]: Attempt - 1
[*] => Moving on to the next post
[*] => Waiting for 3 seconds
[*] => Liking post: 9
[like]: Attempt - 1
[*] => Moving on to the next post
[*] => Waiting for 3 seconds
[*] => Liking post: 10
[like]: Attempt - 1
[*] => Moving on to the next post
[*] => Waiting for 3 seconds
[*] => Script finished successfully
[*] => Total time taken: 44.8863 seconds
bugbounted commented 2 years ago

2022-05-31T06:16:35.417465+00:00 app[worker.1]: 2022-05-31T06:16:35.417475+00:00 app[worker.1]: __ ____ _ 2022-05-31T06:16:35.417476+00:00 app[worker.1]: | | | / | /_\ _| | | | |/ | / / | \/ || )/ | | 2022-05-31T06:16:35.417476+00:00 app[worker.1]: | || .` _ \ | |/ || | | || ' <| | (| () | |\/| |__| | () || |
2022-05-31T06:16:35.417476+00:00 app[worker.1]: |
||\|/ |// \\ |__|||_|__\_/|| || |__/\/ |_|
2022-05-31T06:16:35.417477+00:00 app[worker.1]:
2022-05-31T06:16:35.417477+00:00 app[worker.1]: insta-likecom-bot v.1.4 2022-05-31T06:16:35.417478+00:00 app[worker.1]: Automates likes and comments on an instagram account or tag 2022-05-31T06:16:35.417478+00:00 app[worker.1]: 2022-05-31T06:16:35.417479+00:00 app[worker.1]: Author: Shine Jayakumar 2022-05-31T06:16:35.417479+00:00 app[worker.1]: Github: https://github.com/shine-jayakumar 2022-05-31T06:16:35.417479+00:00 app[worker.1]:
2022-05-31T06:16:35.417484+00:00 app[worker.1]:
2022-05-31T06:16:35.417760+00:00 app[worker.1]: [] => Script started 2022-05-31T06:16:35.417777+00:00 app[worker.1]: [] => Loaded comments from mycomments.txt 2022-05-31T06:16:35.417846+00:00 app[worker.1]: [] => Initializing instagram user 2022-05-31T06:16:38.192986+00:00 app[worker.1]: [] => Setting target to: manotoofficial 2022-05-31T06:16:38.193025+00:00 app[worker.1]: [] => Attempting to log in with pmtoome 2022-05-31T06:16:42.438193+00:00 app[worker.1]: [] => Login successful 2022-05-31T06:16:42.438229+00:00 app[worker.1]: [] => Skipping Save Login Info 2022-05-31T06:16:43.483738+00:00 app[worker.1]: [] => Opening target manotoofficial 2022-05-31T06:16:43.483811+00:00 app[worker.1]: [open_target]: Attempt - 1 2022-05-31T06:16:48.239738+00:00 app[worker.1]: [] => No. of posts found: 78717 2022-05-31T06:16:48.378859+00:00 app[worker.1]: [] => Number of posts to like: 78717 2022-05-31T06:16:48.379793+00:00 app[worker.1]: [] => Liking post: 1 2022-05-31T06:16:48.379837+00:00 app[worker.1]: [like]: Attempt - 1 2022-05-31T06:16:49.416025+00:00 app[worker.1]: [] => Commenting on the post 2022-05-31T06:16:49.416043+00:00 app[worker.1]: [comment]: Attempt - 1 2022-05-31T06:16:49.416105+00:00 app[worker.1]: [] => Script ended with error : 'Insta' object has no attribute 'browser' 2022-05-31T06:16:49.482994+00:00 app[worker.1]: [] => Total time taken: 14.0653 seconds 2022-05-31T06:16:49.733121+00:00 heroku[worker.1]: Process exited with status 0 2022-05-31T06:16:49.788424+00:00 heroku[worker.1]: State changed from up to crashed

why tell me this error : [*] => Script ended with error : 'Insta' object has no attribute 'browser'

waiting for your response regards

bugbounted commented 2 years ago

also get error on hashtag case below :

python instalikecombot.py pmtoome SYfyPacx6DTg #انگیزشی -ps "follow : @bugbounted" -nc -np 10 -d 3

2022-05-31T06:20:29.707963+00:00 app[api]: Release v1 created by user pmtoome@proton.me 2022-05-31T06:20:29.707963+00:00 app[api]: Initial release by user pmtoome@proton.me 2022-05-31T06:20:30.017024+00:00 app[api]: Release v2 created by user pmtoome@proton.me 2022-05-31T06:20:30.017024+00:00 app[api]: Enable Logplex by user pmtoome@proton.me 2022-05-31T06:20:30.238864+00:00 app[api]: Set CHROMEDRIVER_PATH, GOOGLE_CHROME_BIN config vars by user pmtoome@proton.me 2022-05-31T06:20:30.238864+00:00 app[api]: Release v3 created by user pmtoome@proton.me 2022-05-31T06:20:31.000000+00:00 app[api]: Build started by user pmtoome@proton.me 2022-05-31T06:23:01.311616+00:00 heroku[worker.1]: State changed from starting to up 2022-05-31T06:23:02.537825+00:00 heroku[worker.1]: Process exited with status 2 2022-05-31T06:23:02.367852+00:00 app[worker.1]: usage: instalikecombot.py [-h] [-np NOOFPOSTS] [-ps TEXT] [-c FILE | -nc] [-d DELAY] username password target 2022-05-31T06:23:02.367905+00:00 app[worker.1]: instalikecombot: error: the following arguments are required: target 2022-05-31T06:23:02.583045+00:00 heroku[worker.1]: State changed from up to crashed 2022-05-31T06:23:02.590837+00:00 heroku[worker.1]: State changed from crashed to starting 2022-05-31T06:23:12.950224+00:00 heroku[worker.1]: State changed from starting to up 2022-05-31T06:21:55.408507+00:00 app[api]: Release v4 created by user pmtoome@proton.me 2022-05-31T06:23:13.822060+00:00 heroku[worker.1]: State changed from up to crashed 2022-05-31T06:23:13.772599+00:00 heroku[worker.1]: Process exited with status 2 2022-05-31T06:21:55.408507+00:00 app[api]: Deploy by user pmtoome@proton.me 2022-05-31T06:23:13.648811+00:00 app[worker.1]: usage: instalikecombot.py [-h] [-np NOOFPOSTS] [-ps TEXT] [-c FILE | -nc] [-d DELAY] username password target 2022-05-31T06:23:13.648900+00:00 app[worker.1]: instalikecombot: error: the following arguments are required: target

shine-jayakumar commented 2 years ago

Hi @elmirarokni , Finally, we're getting somewhere. I understand the issue. This seems to be a miss when I changed the code to make it work with heroku. The bug will be fixed soon and the branch - heroku-hosting-chrome will be updated.

Regards, Shine

shine-jayakumar commented 2 years ago

Hi @elmirarokni , Finally, we're getting somewhere. I understand the issue. This seems to be a miss when I changed the code to make it work with heroku. The bug will be fixed soon and the branch - heroku-hosting-chrome will be updated.

Regards, Shine

Hi @elmirarokni,

The branch has been updated and tested. It was a tiny bug and it's now been fixed.

Regards, Shine

shine-jayakumar commented 2 years ago

python instalikecombot.py pmtoome SYfyPacx6DTg #انگیزشی -ps "follow : @bugbounted" -nc -np 10 -d 3

A # sign is used to place a comment in Bash and PowerShell. Anything after a # is ignored. This is already mentioned in the README. You just need to enclose the tag in quotes:

python instalikecombot.py pmtoome SYfyPacx6DTg "#انگیزشی" -ps "follow : @bugbounted" -nc -np 10 -d 3

~ $ python instalikecombot.py pmtoome SYfyPacx6DTg "#انگیزشی" -ps "follow : @bugbounted" -nc -np 10 -d 3

     ___ _  _ ___ _____ _      _    ___ _  _____ ___ ___  __  __     ___  ___ _____ 
    |_ _| \| / __|_   _/_\ ___| |  |_ _| |/ | __/ __/ _ \|  \/  |___| _ )/ _ |_   _|
     | || .` \__ \ | |/ _ |___| |__ | || ' <| _| (_| (_) | |\/| |___| _ | (_) || |  
    |___|_|\_|___/ |_/_/ \_\  |____|___|_|\_|___\___\___/|_|  |_|   |___/\___/ |_|  

    insta-likecom-bot v.1.4
    Automates likes and comments on an instagram account or tag

    Author: Shine Jayakumar
    Github: https://github.com/shine-jayakumar

[*] => Script started
[*] => Initializing instagram user
[*] => Setting target to: #انگیزشی
[*] => Attempting to log in with pmtoome
[*] => Login successful
[*] => Skipping Save Login Info
[*] => Opening target #انگیزشی
[open_target]: Attempt - 1
[*] => No. of posts found: 4263686
[*] => Number of posts to like: 10
[*] => Liking post: 1
[like]: Attempt - 1
[*] => Moving on to the next post
[*] => Waiting for 3 seconds
[*] => Liking post: 2
[like]: Attempt - 1
[*] => Moving on to the next post
[*] => Waiting for 3 seconds
[*] => Liking post: 3
[like]: Attempt - 1
[*] => Moving on to the next post
[*] => Waiting for 3 seconds
[*] => Liking post: 4
[like]: Attempt - 1
[*] => Moving on to the next post
[*] => Waiting for 3 seconds
[*] => Liking post: 5
[like]: Attempt - 1
[*] => Moving on to the next post
[*] => Waiting for 3 seconds
[*] => Liking post: 6
[like]: Attempt - 1
[*] => Moving on to the next post
[*] => Waiting for 3 seconds
[*] => Liking post: 7
[like]: Attempt - 1
[*] => Moving on to the next post
[*] => Waiting for 3 seconds
[*] => Liking post: 8
[like]: Attempt - 1
[*] => Moving on to the next post
[*] => Waiting for 3 seconds
[*] => Liking post: 9
[like]: Attempt - 1
[*] => Moving on to the next post
[*] => Waiting for 3 seconds
[*] => Liking post: 10
[like]: Attempt - 1
[*] => Moving on to the next post
[*] => Waiting for 3 seconds
[*] => Script finished successfully
[*] => Total time taken: 47.3714 seconds

Regards, Shine