radulepy / instagrambot Goto Github PK
View Code? Open in Web Editor NEWInstagram AUTO Like and Comment Python BOT
License: GNU General Public License v2.0
Instagram AUTO Like and Comment Python BOT
License: GNU General Public License v2.0
Hi, I just finished setting this up, and I did everything that was in the readme.
The bot works fine for the first part, it opens the webpage, it logs in, it goes to the explore page.
But then it just sits on the explore page and does nothing.
Anyone know why this is?
Thanks
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//*[@id="react-root"]/section/main/div/article/div/div[1]/div/form/div[4]/button"}
(Session info: chrome=85.0.4183.83)
Hi, I just finished setting this up, and I did everything that was in the readme.
The bot works fine for the first part, it opens the webpage, it logs in, it goes to the explore page.
But then it just sits on the explore page and does nothing.
Not working Even after doubling the sleep Time.
My Average Internet Speed is 9-10 Mbps.
Thanks
Hello dude!
How is going? Can you help me a тв tell how to launch your bot with Kali linux?
I did everything but recieve this message
root@kali:~/InstagramBot# python3 instagramBot.py
instagramBot.py:21: DeprecationWarning: executable_path has been deprecated, please pass in a Service object
browser = webdriver.Chrome(executable_path= r"/root/Downloads/chromedriver") # <----- ENTER PATH HERE
Traceback (most recent call last):
File "instagramBot.py", line 21, in
browser = webdriver.Chrome(executable_path= r"/root/Downloads/chromedriver") # <----- ENTER PATH HERE
File "/usr/lib/python3/dist-packages/selenium/webdriver/chrome/webdriver.py", line 95, in init
RemoteWebDriver.init(
File "/usr/lib/python3/dist-packages/selenium/webdriver/remote/webdriver.py", line 152, in init
self.start_session(capabilities, browser_profile)
File "/usr/lib/python3/dist-packages/selenium/webdriver/remote/webdriver.py", line 249, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "/usr/lib/python3/dist-packages/selenium/webdriver/remote/webdriver.py", line 318, in execute
self.error_handler.check_response(response)
File "/usr/lib/python3/dist-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally.
(unknown error: DevToolsActivePort file doesn't exist)
(The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
When the program is run it does not start as it comes up with:
TypeError: WebDriver.init() got an unexpected keyword argument 'executable_path'
Steps to reproduce the behavior:
run program
Expected behavior
Program to run normally
Desktop:
Describe the bug
There is another bug.
After accepting the cookies, the script uses the credentials, logs in, but then gets another notification:
Do you want to “Save login Details”? Where you can press Save login details, or, not now.
Next, another message where it asks if you want to enable notifications. You can press yes, or not now.
Lastly, I don’t want to place comments but only like posts, how do I do that?
Chrome97
Windows10
I have been trying to run your code and keep getting this error:
le "C:\Users\Ben\Downloads\InstagramBot-master\InstagramBot-master\instagramBot.py", line 8, in
from selenium import webdriver
ModuleNotFoundError: No module named 'selenium'
I'm not sure if this is due to user error or an issue with the code, so i'll submit it here.
Got it running, kinda.
it opens chrome and types in the user name and password, but that is all.
this is what terminal shows me....
thisisme-iMac:InstagramBot thisisme$ python3 instagramBot.py Traceback (most recent call last): File "/Users/thisisme/Desktop/InstagramBot/instagramBot.py", line 83, in <module> start() File "/Users/thisisme/Desktop/InstagramBot/instagramBot.py", line 68, in start nextButton = browser.find_element_by_xpath('/html/body/div[1]/section/main/div/article/div/div[1]/div/form/div/div[3]/button ') File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py", line 394, in find_element_by_xpath return self.find_element(by=By.XPATH, value=xpath) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py", line 976, in find_element return self.execute(Command.FIND_ELEMENT, { File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute self.error_handler.check_response(response) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"/html/body/div[1]/section/main/div/article/div/div[1]/div/form/div/div[3]/button "} (Session info: chrome=90.0.4430.72) #
I get this error when I try to run Instagrambot:
"D:\Programme\JetBrains\PyCharm Community Edition 2021.2.1\env\Scripts\python.exe" C:/Users/ebrul/Desktop/InstagramBot/instagramBot.py
Traceback (most recent call last):
File "C:/Users/ebrul/Desktop/InstagramBot/instagramBot.py", line 89, in <module>
start()
File "C:/Users/ebrul/Desktop/InstagramBot/instagramBot.py", line 66, in start
acceptCookies = browser.find_element_by_xpath('/html/body/div[2]/div/div/div/div[2]/button[1]');
File "D:\Programme\JetBrains\PyCharm Community Edition 2021.2.1\env\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 394, in find_element_by_xpath
return self.find_element(by=By.XPATH, value=xpath)
File "D:\Programme\JetBrains\PyCharm Community Edition 2021.2.1\env\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 976, in find_element
return self.execute(Command.FIND_ELEMENT, {
File "D:\Programme\JetBrains\PyCharm Community Edition 2021.2.1\env\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "D:\Programme\JetBrains\PyCharm Community Edition 2021.2.1\env\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"/html/body/div[2]/div/div/div/div[2]/button[1]"}
(Session info: chrome=95.0.4638.54)
Process finished with exit code 1
It just opens https://www.instagram.com/accounts/login/?source=auth_switcher with chrome and that's it.
the only thing I've changed is the comments, webdriver dir, and my account info. How can I fix this?
Describe the bug
Error is thrown after running the .py file. Browser spawns but unable to locate the fields, likely because IG has made updates since the last commit.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Spawn new browser window, go to Instagram website and login as user with provided hard-coded credentials.
Desktop (please complete the following information):
**Chrome Driver
Additional context
python instagramBot.py
C:\Users\John\OneDrive\Desktop\InstagramBot-master\instagramBot.py:21: DeprecationWarning: executable_path has been deprecated, please pass in a Service object
browser = webdriver.Chrome(executable_path=r'C:\Users\John\OneDrive\Desktop\InstagramBot-master\chromedriver.exe') # <----- ENTER PATH HERE
DevTools listening on ws://127.0.0.1:49429/devtools/browser/1e2dcb9c-f950-4f30-8fd9-97bf8917f03a
C:\Users\John\OneDrive\Desktop\InstagramBot-master\instagramBot.py:62: DeprecationWarning: find_element_by_xpath is deprecated. Please use find_element(by=By.XPATH, value=xpath) instead
acceptCookies = browser.find_element_by_xpath('/html/body/div[4]/div/div/button[1]');
Traceback (most recent call last):
File "C:\Users\John\OneDrive\Desktop\InstagramBot-master\instagramBot.py", line 85, in <module>
start()
File "C:\Users\John\OneDrive\Desktop\InstagramBot-master\instagramBot.py", line 62, in start
acceptCookies = browser.find_element_by_xpath('/html/body/div[4]/div/div/button[1]');
File "C:\Users\John\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\selenium\webdriver\remote\webdriver.py", line 521, in find_element_by_xpath
return self.find_element(by=By.XPATH, value=xpath)
File "C:\Users\John\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\selenium\webdriver\remote\webdriver.py", line 1248, in find_element
return self.execute(Command.FIND_ELEMENT, {
File "C:\Users\John\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\selenium\webdriver\remote\webdriver.py", line 425, in execute
self.error_handler.check_response(response)
File "C:\Users\John\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\selenium\webdriver\remote\errorhandler.py", line 247, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"/html/body/div[4]/div/div/button[1]"}
(Session info: chrome=100.0.4896.88)
Stacktrace:
Backtrace:
Ordinal0 [0x00297413+2389011]
Ordinal0 [0x00229F61+1941345]
Ordinal0 [0x0011C658+837208]
Ordinal0 [0x001491DD+1020381]
Ordinal0 [0x0014949B+1021083]
Ordinal0 [0x00176032+1204274]
Ordinal0 [0x00164194+1130900]
Ordinal0 [0x00174302+1196802]
Ordinal0 [0x00163F66+1130342]
Ordinal0 [0x0013E546+976198]
Ordinal0 [0x0013F456+980054]
GetHandleVerifier [0x00449632+1727522]
GetHandleVerifier [0x004FBA4D+2457661]
GetHandleVerifier [0x0032EB81+569713]
GetHandleVerifier [0x0032DD76+566118]
Ordinal0 [0x00230B2B+1968939]
Ordinal0 [0x00235988+1989000]
Ordinal0 [0x00235A75+1989237]
Ordinal0 [0x0023ECB1+2026673]
BaseThreadInitThunk [0x76FFFA29+25]
RtlGetAppContainerNamedObjectPath [0x77C77A7E+286]
RtlGetAppContainerNamedObjectPath [0x77C77A4E+238]
(No symbol) [0x00000000]
C:\Users\John\OneDrive\Desktop\InstagramBot-master>[956:4248:0412/111037.859:ERROR:device_event_log_impl.cc(214)] [11:10:37.859] USB: usb_device_handle_win.cc:1049 Failed to read descriptor from node connection: A device attached to the system is not functioning. (0x1F)`
Is it possible for this bot to comment whenever a page posts a new post / comment on the latest feed?
File "C:\Program Files\JetBrains\PyCharm Community Edition 2021.2.2\plugins\python-ce\helpers\pydev\pydevconsole.py", line 5, in
from _pydev_comm.pydev_rpc import make_rpc_client, start_rpc_server, start_rpc_server_and_make_client
File "C:\Program Files\JetBrains\PyCharm Community Edition 2021.2.2\plugins\python-ce\helpers\pydev_pydev_comm\pydev_rpc.py", line 4, in
from pydev_comm.pydev_server import TSingleThreadedServer
File "C:\Program Files\JetBrains\PyCharm Community Edition 2021.2.2\plugins\python-ce\helpers\pydev_pydev_comm\pydev_server.py", line 4, in
from shaded_thriftpy.server import TServer
File "C:\Program Files\JetBrains\PyCharm Community Edition 2021.2.2\plugins\python-ce\helpers\third_party\thriftpy_shaded_thriftpy_init.py", line 5, in
from .hook import install_import_hook, remove_import_hook
File "C:\Program Files\JetBrains\PyCharm Community Edition 2021.2.2\plugins\python-ce\helpers\third_party\thriftpy_shaded_thriftpy\hook.py", line 7, in
from .parser import load_module
File "C:\Program Files\JetBrains\PyCharm Community Edition 2021.2.2\plugins\python-ce\helpers\third_party\thriftpy_shaded_thriftpy\parser_init.py", line 16, in
from .parser import parse, parse_fp, incomplete_type, _cast
File "C:\Program Files\JetBrains\PyCharm Community Edition 2021.2.2\plugins\python-ce\helpers\third_party\thriftpy_shaded_thriftpy\parser\parser.py", line 17, in
from _shaded_thriftpy.compat import urlopen, urlparse, PY3
File "C:\Program Files\JetBrains\PyCharm Community Edition 2021.2.2\plugins\python-ce\helpers\third_party\thriftpy_shaded_thriftpy_compat.py", line 12, in
import platform
File "C:\Users\SALALA\AppData\Local\Programs\Python\Python310\lib\platform.py", line 119, in
import subprocess
File "C:\Users\SALALA\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 8, in
from selenium import webdriver
File "C:\Users\SALALA\PycharmProjects\pythonProject\venv\lib\site-packages\selenium\webdriver_init.py", line 18, in
from .firefox.webdriver import WebDriver as Firefox # noqa
File "C:\Users\SALALA\PycharmProjects\pythonProject\venv\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 31, in
from .extension_connection import ExtensionConnection
File "C:\Users\SALALA\PycharmProjects\pythonProject\venv\lib\site-packages\selenium\webdriver\firefox\extension_connection.py", line 25, in
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
File "C:\Users\SALALA\PycharmProjects\pythonProject\venv\lib\site-packages\selenium\webdriver\firefox\firefox_binary.py", line 21, in
from subprocess import Popen, STDOUT
ImportError: cannot import name 'Popen' from partially initialized module 'subprocess' (most likely due to a circular import) (C:\Users\SALALA\AppData\Local\Programs\Python\Python310\lib\subprocess.py)
Error on likeAndComm-function Line 34/35:
I get an error, on line 34/35, where the bot, shall find the posts on the explore-page:
my console says:
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"/html/body/div[1]/section/main/div/div[1]/div[1]/div[1]"} (Session info: chrome=111.0.5563.65) Process finished with exit code 1
Could you update the line?
Line 34 / 35
post = browser.find_element_by_xpath( '/html/body/div[1]/section/main/div/div[1]/div/div[' + str(y) + ']/div[' + str(x) + ']')
I get the following error message when I try running the following code driver = webdriver.Chrome(path)
driver.get(web) in python. DeprecationWarning: executable_path has been deprecated, please pass in a Service object
driver = webdriver.Chrome(path)
The Bug
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"/html/body/div[4]/div/div/button[1]"}
(Session info: chrome=105.0.5195.102)
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop :
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.