Code Monkey home page Code Monkey logo

instagram-bot-dm's Introduction

โš ๏ธ Project discontinued

Instagram Direct Message Bot

Send direct and group message with Instagram bot. Work with Python 3.7.2 and Selenium.

Example :

from instadm import InstaDM

if __name__ == '__main__':
	# Auto login
	insta = InstaDM(username='your_username', password='your_password', headless=False)
	
	# Send message
	insta.sendMessage(user='username_target', message='Hey !')
	
	# Send message
	insta.sendGroupMessage(users=['user1', 'user2'], message='Hey !')

Work's with InstaPY

Use instapy_workspace param on constructor:

from instadm import InstaDM

if __name__ == '__main__':
	# Auto login
	insta = InstaDM(
		username='your_username',
		password='your_password',
		headless=False,
		instapy_workspace='workspace/'
	)

InstaDM create table message if not exists.

CREATE TABLE "message" (
	"username"	TEXT NOT NULL UNIQUE,
	"message"	TEXT DEFAULT NULL,
	"sent_message_at"	TIMESTAMP
);

Work's with InstaPY Dashboard

InstaDM works with an modified version of InstaPy Dashboard.

InstaPy Dashboard is an Open Source project developed by @converge to visualize Instagram accounts progress and real-time InstaPy logs on the browser.

Buy me a ๐Ÿบ

instagram-bot-dm's People

Contributors

adwaith-rajesh avatar amartabakovic avatar amastis avatar blendicavlad avatar camtosh avatar dvershinin avatar gusnips avatar hbollon avatar jxlil avatar kowshika-n avatar steve-tech avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

instagram-bot-dm's Issues

It could not install `instadm` with pip

$ pip3 install instadm
ERROR: Could not find a version that satisfies the requirement instadm (from versions: none)
ERROR: No matching distribution found for instadm

$ python3 --version
Python 3.7.7

Error with chrome driver

Hello,

I execute your code

from instadm import InstaDM
if __name__ == '__main__':

	insta = InstaDM(username='******', password='*****', headless=False)
	insta.sendMessage(user='photofriendsoficial', message='Hey !')

but give me a error

Traceback (most recent call last):
  File "C:\Python37\lib\site-packages\selenium\webdriver\common\service.py", line 76, in start
    stdin=PIPE)
  File "C:\Python37\lib\subprocess.py", line 800, in __init__
    restore_signals, start_new_session)
  File "C:\Python37\lib\subprocess.py", line 1207, in _execute_child
    startupinfo)
FileNotFoundError: [WinError 2] El sistema no puede encontrar el archivo especificado

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "mensaje_directo.py", line 4, in <module>
    insta = InstaDM(username='video_boda', password='@iDt_2359', headless=False)
  File "C:\Python37\instagram_mensaje_directo\instadm.py", line 43, in __init__
    self.driver = webdriver.Chrome(options=options)
  File "C:\Python37\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 73, in __init__
    self.service.start()
  File "C:\Python37\lib\site-packages\selenium\webdriver\common\service.py", line 83, in start
    os.path.basename(self.path), self.start_error_message)
selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home

If you dont mind help me... reggards

Not authenticate in Instagram

Hi, I'm testing code below, but browser open and noting happen.

`from instadm import InstaDM

if name == 'main':
# Auto login
insta = InstaDM(username='my_user', password='my_password', headless=False)

# Send message
insta.sendMessage(user='my_user_test', message='Teste!')`

This error showing in the console:
$ python3 dm.py
ERROR:root:Message: no such element: Unable to locate element: {"method":"css selector","selector":"[name="username"]"}
(Session info: chrome=85.0.4183.121)

ERROR:root:'NoneType' object has no attribute 'send_keys'
Exception when typeSlow : 'NoneType' object has no attribute 'send_keys'

Using:
Ubuntu 20.04
chromium-chromedriver 1:85.0.4183.83-0ubuntu0.20.04.1
Python 3.8.2
selenium 3.141.0

Question

Hey, great bot, thanks for sharing. I want to ask, is it possible to share a post to someone and then send a message? If yes, how?

can I use this for a Telegram style bot?

I want to automate customer orders via a chat bot. can I use this for that? below is a example how it works:

(c) means customer and (b) is bot replying
(c) sends a DM
(b) how are you today? for placing an order send 1 and for talking to a person send 5
(c) 1
(b) please send product code. you can find product code below any post in caption
(c) E873
(b) this product is $87. if you want to order it, please let me know how many. if not, please reply with NO
(c) 1
....

you get the idea. this would be super cool. I can even think of Customer Support scenarios

instadm.py err: index out of range

Hi, everyone!

I have this error
ERROR:root:list index out of range

i use this DM bot with INSTAPY

MY START SCRIPT:

from instadm import InstaDM

if __name__ == '__main__':
	# Auto login
	insta = InstaDM(
		username='my_login',
		password='my_passwd',
		headless=False,
		instapy_workspace='/home/skylakert/'
	)


	#insta.login

webdriver_manager.chrome - Problems

Traceback (most recent call last): File "C:\Users\nicor\Documents\Coder\Python\InstaDM\instagram-bot-dm-master\instadm.py", line 2, in <module> from webdriver_manager.chrome import ChromeDriverManager as CM ModuleNotFoundError: No module named 'webdriver_manager'

Some help over here?

image

These are the 3 errors that I can't figure out

logging.info(f'Login with {username}')

Hi, thank you for sharing this code to the community, I have problem on importing your project:

from instadm import InstaDM
  File "/Users/alireza/Workspace/Personal/insta-bot/instagram-bot-dm/instadm.py", line 94
    logging.info(f'Login with {username}')

Tell me if I'm doing something wrong, I made a test.py file into the repo and running it inside the repo.
Thank you in advance.

One question

Hello good afternoon.

I have a question would this script be able to identify and get the private messages that people can send?

Is it possible to share a post with the message?

Hello, can I use this bot to send a post together with the message in DM?

I can do it in the instagram app so it would be great if its also possible here.

Anyway, thanks for the great application!

Can't send multi line messages

When sending a multi line message with the sendMessage or the sendGroupMessage method the "Send" button disappears. When the message is fully typed the bot tries to send it by looking for the "Send" button but it can't be found.

I tried to solve this by pressing the Keys.RETRUN or Keys.ENTER buttons, but both don't work.

EDIT:
Found out that it can't press the "Send" button because the "This web browser is no longer supported." banner is in the way. I don't know how to upgrade the browser without breaking the bot.

My solutuon is to remove the banner with the following code in the typeMessage method just before the click on the send button.

try:
     element = self.driver.find_element_by_class_name('pwPDf')
     self.driver.execute_script("""
     var element = arguments[0];
     element.parentNode.removeChild(element);
     """, element)
except:
    pass

Crash on send in multiple line.

I try to send :

insta.sendMessage(user='my_ID', message='Hello\n my\n name \n is \n RSA')

Error:

[12364:9996:0201/183830.300:ERROR:ssl_client_socket_impl.cc(996)] handshake failed; returned -1, SSL error code 1, net_error -101
ERROR:root:Message: element click intercepted: Element <button class="sqdOP yWX7d    y3zKF     " type="button">...</button> is not clickable at point (433, 529). Other element would receive the click: <span class="_7UhW9    vy6Bb     MMzan       gtFbE      se6yk        ">...</span>
  (Session info: chrome=97.0.4692.99)

ERROR:root:list index out of range

i'm trying to call instaDM after every follow whem im using some instapy quickscripts and i got this:

DevTools listening on ws://127.0.0.1:55282/devtools/browser/688f1610-8a18-4224-9d75-f518905f5c3e
[9264:11452:0908/113103.000:ERROR:device_event_log_impl.cc(208)] [11:31:03.000] Bluetooth: bluetooth_adapter_winrt.cc:1074 Getting Default Adapter failed.
ERROR:root:list index out of range

already updated chromedriver

and i got this strange file...
20200908-113700.zip

and prob this line is hell wrong too, i'm such a newbye
" insta = InstaDM(username='insta_username', password='insta_password', headless=False)"

thx in advance

How to send mass DMs?

I want to send mass DMs using this tool, should I loop through the line of sending because it does make sense, authenticate once and loop to send.
need feedback here.

Use InstaPYs 2FA and grab from a list

I want to put both instadm with instapy. I have a list on one line in a .json file.

In this format

[somename, here, is, how, it, is, listed]

I want to use the 'user' variable in "insta.sendMessage(user, message='some message')
I want it take from that list in iterations instead of one at a time.
I've tried importing instapy and logging in a session then finishing with instaDM, but that failed. instaDM opens another socket of it's own.

The 2FA issue instaDM does not have that module

v0.0.3 instadm.py line 133

I have gotten this error :

from instadm import InstaDM
File "C:\Users\xxxx\Downloads\instagram-bot-dm-v.0.0.3\instagram-bot-dm-v.0.0.3\instadm.py", line 133
self.__remove_browser_unsupported_banner_if_exists(self, element):

SyntaxError: invalid syntax

I have removed the ":" from "self.__remove_browser_unsupported_banner_if_exists(self, element):". And then I have tried again. But it didn't send a message.

And then I have gotten like this error :

ERROR:root:name 'element' is not defined
ERROR:root:162
PS C:\Users\xxxx\Downloads\instagram-bot-dm-v.0.0.3\instagram-bot-dm-v.0.0.3> [8372:2608:0510/230226.751:ERROR:gpu_init.cc(481)] Passthrough is not supported, GL is disabled, ANGLE is

I have removed "self.__remove_browser_unsupported_banner_if_exists(self, element)" this line from typeMessage method. I can send the a message successfully. You have to fix this in the repo.

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.