alexal1 / insomniac Goto Github PK
View Code? Open in Web Editor NEWInstagram bot for automated Instagram interaction using Android device via ADB
Home Page: https://insomniac-bot.com
License: MIT License
Instagram bot for automated Instagram interaction using Android device via ADB
Home Page: https://insomniac-bot.com
License: MIT License
I noticed that when after a crash happens and interaction with current blogger starts from the beginning, the script doesn't count already made interactions. This can lead to a very long interaction.
Open as issue to discuss and follow implementation.
As a user of this app, I want to be able to get analytics of people that I could potentially follow so that the app can filter out whether or not the person is worth following. Specifically the new requested data point is around a bloggers a follower count, following count, and follower/following ratio.
Issue:
Not sure how the app is currently identifing elements from the app. Currently need to understand how the elements are all selected/identified then will be able to implement the code.
Traceback (most recent call last):
File "insomniac.py", line 132, in _job_handle_bloggers
handle_blogger(device, username, likes_count, follow_percentage, storage, _on_like, on_interaction)
File "/home/pi/Insomniac/action_handle_blogger.py", line 23, in handle_blogger
if not _open_user_followers(device, username):
File "/home/pi/Insomniac/action_handle_blogger.py", line 64, in _open_user_followers
followers_button.click.wait()
File "/home/pi/.local/lib/python3.7/site-packages/uiautomator/init.py", line 76, in call
return self.func(*args, **kwargs)
File "/home/pi/.local/lib/python3.7/site-packages/uiautomator/init.py", line 975, in _click
return self.jsonrpc.clickAndWaitForNewWindow(self.selector, timeout)
File "/home/pi/.local/lib/python3.7/site-packages/uiautomator/init.py", line 458, in wrapper
return _method_obj(*args, **kwargs)
File "/home/pi/.local/lib/python3.7/site-packages/uiautomator/init.py", line 135, in call
"%s: %s" % (jsonresult["error"]["data"]["exceptionTypeName"], jsonresult["error"]["message"])
uiautomator.JsonRPCError: JsonRPC Error code: -32002, Message: android.support.test.uiautomator.UiObjectNotFoundException: UiSelector[CLASS=android.widget.LinearLayout, RESOURCE_ID=com.instagram.android:id/row_profile_header_followers_container]
Device: Nexus 5, initial I had it on a xiaomi, but i had to have the sim inserted to have some debug properties unlocked, so, i changed to the good old nexus 5. Don't know if the fact that i've changed the device somehow messed up
i get this error:
Traceback (most recent call last):
File "insomniac.py", line 331, in wrapper
func(*args, **kwargs)
File "insomniac.py", line 149, in job
on_interaction)
File "/home/pi/Insomniac/src/action_handle_blogger.py", line 32, in handle_blogger
_iterate_over_followers(device, interaction, storage, on_interaction, is_myself)
File "/home/pi/Insomniac/src/action_handle_blogger.py", line 104, in _iterate_over_followers
className='android.widget.LinearLayout'):
File "/usr/local/lib/python3.6/site-packages/uiautomator/__init__.py", line 1222, in next
return obj[self.index]
File "/usr/local/lib/python3.6/site-packages/uiautomator/__init__.py", line 1203, in getitem
raise IndexError()
IndexError
Hello,
I am having issues getting the script to run. I believe I've done all the steps, but when I try to run the Python script it will not produce any outcome.
-Developer enables
-Stay awake enabled
-USB Debugging enabled
-uiautomator/colorama installed
-android platform tools installed and added to PATH
Any pointers will be much appreciated on what I'm omitting/not doing properly (I use Windows and I typically don't use an Android so please bear with me)
[06/26 23:12:57] Open Instagram app
[06/26 23:12:58] Sleep for 2 seconds
[06/26 23:13:00] Press profile
Traceback (most recent call last):
File "/home/pi/.local/lib/python3.7/site-packages/uiautomator/init.py", line 438, in wrapper
return _method_obj(*args, **kwargs)
File "/home/pi/.local/lib/python3.7/site-packages/uiautomator/init.py", line 127, in call
result = urllib2.urlopen(req, timeout=self.timeout)
File "/usr/lib/python3.7/urllib/request.py", line 222, in urlopen
return opener.open(url, data, timeout)
File "/usr/lib/python3.7/urllib/request.py", line 525, in open
response = self._open(req, data)
File "/usr/lib/python3.7/urllib/request.py", line 543, in _open
'_open', req)
File "/usr/lib/python3.7/urllib/request.py", line 503, in _call_chain
result = func(*args)
File "/usr/lib/python3.7/urllib/request.py", line 1345, in http_open
return self.do_open(http.client.HTTPConnection, req)
File "/usr/lib/python3.7/urllib/request.py", line 1320, in do_open
r = h.getresponse()
File "/usr/lib/python3.7/http/client.py", line 1336, in getresponse
response.begin()
File "/usr/lib/python3.7/http/client.py", line 306, in begin
version, status, reason = self._read_status()
File "/usr/lib/python3.7/http/client.py", line 267, in _read_status
line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
File "/usr/lib/python3.7/socket.py", line 589, in readinto
return self._sock.recv_into(b)
ConnectionResetError: [Errno 104] Connection reset by peer
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "insomniac.py", line 343, in
main()
File "insomniac.py", line 71, in main
session_state.my_username = get_my_username(device)
File "/home/pi/Insomniac/action_get_my_username.py", line 10, in get_my_username
profile_button.click.wait()
File "/home/pi/.local/lib/python3.7/site-packages/uiautomator/init.py", line 76, in call
return self.func(*args, **kwargs)
File "/home/pi/.local/lib/python3.7/site-packages/uiautomator/init.py", line 975, in _click
return self.jsonrpc.clickAndWaitForNewWindow(self.selector, timeout)
File "/home/pi/.local/lib/python3.7/site-packages/uiautomator/init.py", line 442, in wrapper
server.start(timeout=30)
File "/home/pi/.local/lib/python3.7/site-packages/uiautomator/init.py", line 498, in start
raise IOError("RPC server not started!")
OSError: RPC server not started!
I can't figure it out what the problem is, did anyone else had the same problem?
Hi, I want to try this script on mi RpiB3+ but I’m unable to find any androidsdk working on armhf.
Anyone have installed the android platform tools on raspberry pi?
Thanks
EDIT: I’ve installed android-tools-adb and android-tools-fastboot, adb server started so I will try to connect a phone asap and see if device will be recognized.
tha app open on the phone after it s just show this message on the terminal
if you can help me thank you
home2@home2-VirtualBox:~/Insomniac$ python3 insomniac.py --bloggers marco_verratti92
Insomniac v1.2.4
Connected devices via adb: 1. That's ok.
bloggers = marco_verratti92
-------- START: 2020-06-10 16:39:36.630498 --------
Open Instagram app
Sleep for 4 seconds
Handle @marco_verratti92
Press search
Traceback (most recent call last):
File "/home/home2/.local/lib/python3.8/site-packages/uiautomator/init.py", line 438, in wrapper
return _method_obj(*args, **kwargs)
File "/home/home2/.local/lib/python3.8/site-packages/uiautomator/init.py", line 127, in call
result = urllib2.urlopen(req, timeout=self.timeout)
File "/usr/lib/python3.8/urllib/request.py", line 222, in urlopen
return opener.open(url, data, timeout)
File "/usr/lib/python3.8/urllib/request.py", line 525, in open
response = self._open(req, data)
File "/usr/lib/python3.8/urllib/request.py", line 542, in _open
result = self._call_chain(self.handle_open, protocol, protocol +
File "/usr/lib/python3.8/urllib/request.py", line 502, in _call_chain
result = func(*args)
File "/usr/lib/python3.8/urllib/request.py", line 1355, in http_open
return self.do_open(http.client.HTTPConnection, req)
File "/usr/lib/python3.8/urllib/request.py", line 1330, in do_open
r = h.getresponse()
File "/usr/lib/python3.8/http/client.py", line 1332, in getresponse
response.begin()
File "/usr/lib/python3.8/http/client.py", line 303, in begin
version, status, reason = self._read_status()
File "/usr/lib/python3.8/http/client.py", line 272, in _read_status
raise RemoteDisconnected("Remote end closed connection without"
http.client.RemoteDisconnected: Remote end closed connection without response
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "insomniac.py", line 219, in
main()
File "insomniac.py", line 49, in main
_job_handle_bloggers(device, args.bloggers, int(args.likes_count), storage, on_interaction)
File "insomniac.py", line 90, in _job_handle_bloggers
handle_blogger(device, blogger, likes_count, storage, _on_like, on_interaction)
File "/home/home2/Insomniac/action_handle_blogger.py", line 17, in handle_blogger
_open_user_followers(device, username)
File "/home/home2/Insomniac/action_handle_blogger.py", line 25, in _open_user_followers
search_button.click.wait()
File "/home/home2/.local/lib/python3.8/site-packages/uiautomator/init.py", line 76, in call
return self.func(*args, **kwargs)
File "/home/home2/.local/lib/python3.8/site-packages/uiautomator/init.py", line 975, in _click
return self.jsonrpc.clickAndWaitForNewWindow(self.selector, timeout)
File "/home/home2/.local/lib/python3.8/site-packages/uiautomator/init.py", line 442, in wrapper
server.start(timeout=30)
File "/home/home2/.local/lib/python3.8/site-packages/uiautomator/init.py", line 498, in start
raise IOError("RPC server not started!")
OSError: RPC server not started!
According to what we have talked about in telegram, the interactions are currently working pro session and not by blogger.
I hope it can be fixed soon.
Cannot catch and replay this bug, maybe you guys have thoughts.
Sometimes IGTV fullscreen is accidentally being opened and then the script goes into infinite loop. It tries to find "search" button but can't. I have two questions:
open_instagram()
function is called, it runs adb shell am start -n com.instagram.android/com.instagram.mainactivity.MainActivity
command. Could you please check if this command returns you to the main screen while playing IGTV?If one follower of the target account is private then the process stop with error
"Probably need to scroll"
I think we need to find a way to avoid private account.
In my country it is common to post short videos in the feed with 0-3 seconds (GIF converted to video). When the code sees this type of post it crashes and fails to like.
CDM:
Traceback (most recent call last):
File "C:\Users\xxxx\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connectionpool.py", line 426, in _make_request
six.raise_from(e, None)
File "", line 3, in raise_from
File "C:\Users\xxxx\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connectionpool.py", line 421, in _make_request
httplib_response = conn.getresponse()
File "C:\Users\xxxx\AppData\Local\Programs\Python\Python38\lib\http\client.py", line 1332, in getresponse
response.begin()
File "C:\Users\xxxx\AppData\Local\Programs\Python\Python38\lib\http\client.py", line 303, in begin
version, status, reason = self._read_status()
File "C:\Users\xxxx\AppData\Local\Programs\Python\Python38\lib\http\client.py", line 264, in _read_status
line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
File "C:\Users\xxxx\AppData\Local\Programs\Python\Python38\lib\socket.py", line 669, in readinto
return self._sock.recv_into(b)
socket.timeout: timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "insomniac.py", line 351, in
main()
File "insomniac.py", line 79, in main
_job_handle_bloggers(device,
File "insomniac.py", line 157, in _job_handle_bloggers
raise e
File "insomniac.py", line 137, in _job_handle_bloggers
handle_blogger(device, username, likes_count, follow_percentage, storage, _on_like, on_interaction)
File "C:\Users\xxxx\Desktop\Python\Insomniac-master\action_handle_blogger.py", line 27, in handle_blogger
_iterate_over_followers(device, interaction, storage, on_interaction, is_myself)
File "C:\Users\xxxx\Desktop\Python\Insomniac-master\action_handle_blogger.py", line 127, in _iterate_over_followers
interaction_succeed, followed = interaction(device, username=username, can_follow=can_follow)
File "C:\Users\xxxx\Desktop\Python\Insomniac-master\action_handle_blogger.py", line 185, in interact_with_user
if not open_photo_and_like(device, row, column, on_like):
File "C:\Users\xxxx\Desktop\Python\Insomniac-master\action_handle_blogger.py", line 227, in open_photo_and_like
action_bar_bottom = action_bar.bounds['bottom']
File "C:\Users\xxxx\AppData\Local\Programs\Python\Python38\lib\site-packages\uiautomator_init.py", line 934, in getattr
info = self.info
File "C:\Users\xxxx\AppData\Local\Programs\Python\Python38\lib\site-packages\uiautomator_init.py", line 945, in info
return self.jsonrpc.objInfo(self.selector)
File "C:\Users\xxxx\AppData\Local\Programs\Python\Python38\lib\site-packages\uiautomator_init.py", line 443, in wrapper
return JsonRPCMethod(url, method, timeout, False)(*args, **kwargs)
File "C:\Users\xxxx\AppData\Local\Programs\Python\Python38\lib\site-packages\uiautomator_init.py", line 438, in wrapper
return method_obj(*args, **kwargs)
File "C:\Users\xxxx\AppData\Local\Programs\Python\Python38\lib\site-packages\uiautomator_init.py", line 115, in call
res = self.pool.urlopen("POST",
File "C:\Users\xxxx\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\poolmanager.py", line 336, in urlopen
response = conn.urlopen(method, u.request_uri, **kw)
File "C:\Users\xxxx\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connectionpool.py", line 724, in urlopen
retries = retries.increment(
File "C:\Users\xxxx\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\util\retry.py", line 403, in increment
raise six.reraise(type(error), error, _stacktrace)
File "C:\Users\xxxx\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\packages\six.py", line 735, in reraise
raise value
File "C:\Users\xxxx\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connectionpool.py", line 670, in urlopen
httplib_response = self._make_request(
File "C:\Users\xxxx\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connectionpool.py", line 428, in _make_request
self._raise_timeout(err=e, url=url, timeout_value=read_timeout)
File "C:\Users\xxxx\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connectionpool.py", line 335, in _raise_timeout
raise ReadTimeoutError(
urllib3.exceptions.ReadTimeoutError: HTTPConnectionPool(host='localhost', port=9008): Read timed out. (read timeout=90)
Guys, how's it going?
I think it is very useful to add a likes counter to the window that is displayed while the script is running, this is very necessary to know how much time is left to
end the execution or also when an internet interruption occurs, know where you left the number and then run it again and add the missing likes.
Any questions, I am available
Regards!
Could you please provide some quickstart example?
Where to put acc and pass?
Problem:
Sometimes target accounts changing their usernames or not exist anymore so Insomniac can't find them via search and instead, it opens the first hashtag and then crashes, or opens the first username that looks like it and tries to make activity there.
Possible solutions:
Hello brother, I think the action —bloggers should be —likefollowers and these interacted_users.txt should be likedfollowers.txt
this is a better name for what this action really do.
-followedfollowers.txt
-unfollowed.txt
-followed.txt
-followedhashtags.txt
An idea unfollowing / unfollow non followers...
Is there anyway scroll down to get all text value in
com.instagram.android:id/follow_list_username
From followers and following in 2 different followers.txt following.txt
compare both in python backside then create a nonfollowers.txt
Then start to unfollow by a list?
Also cold be added functions as —followlist and —unfollowlist
—skiplist
I m trying to understand how code works to help on improvement, can’t you make a short video explaining how to you are working on for helping us make it grow faster? Think about that
I m not sure how adb works... Do you think that is there anyway to turn all that actions into an Android native app using kivy / buildozer importing adb and uiautomator library on it?
Why aren’t you writing this code using python3? Like code is right now it will also works on python2 as we know the way python2 goes...
I will be attentive on your comments.
Traceback (most recent call last):
File "/home/pi/.local/lib/python3.7/site-packages/uiautomator/__init__.py", line 438, in wrapper
return _method_obj(*args, **kwargs)
File "/home/pi/.local/lib/python3.7/site-packages/uiautomator/__init__.py", line 135, in __call__
"%s: %s" % (jsonresult["error"]["data"]["exceptionTypeName"], jsonresult["error"]["message"])
uiautomator.JsonRPCError: JsonRPC Error code: -32002, Message: android.support.test.uiautomator.UiObjectNotFoundException: UiSelector[CLASS=android.widget.LinearLayout, RESOURCE_ID=com.instagram.android:id/row_profile_header_followers_container]
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "insomniac.py", line 132, in _job_handle_bloggers
handle_blogger(device, username, likes_count, follow_percentage, storage, _on_like, on_interaction)
File "/home/pi/Insomniac/action_handle_blogger.py", line 23, in handle_blogger
if not _open_user_followers(device, username):
File "/home/pi/Insomniac/action_handle_blogger.py", line 63, in _open_user_followers
followers_button.click.wait()
File "/home/pi/.local/lib/python3.7/site-packages/uiautomator/__init__.py", line 76, in __call__
return self.func(*args, **kwargs)
File "/home/pi/.local/lib/python3.7/site-packages/uiautomator/__init__.py", line 975, in _click
return self.jsonrpc.clickAndWaitForNewWindow(self.selector, timeout)
File "/home/pi/.local/lib/python3.7/site-packages/uiautomator/__init__.py", line 458, in wrapper
return _method_obj(*args, **kwargs)
File "/home/pi/.local/lib/python3.7/site-packages/uiautomator/__init__.py", line 135, in __call__
"%s: %s" % (jsonresult["error"]["data"]["exceptionTypeName"], jsonresult["error"]["message"])
uiautomator.JsonRPCError: JsonRPC Error code: -32002, Message: android.support.test.uiautomator.UiObjectNotFoundException: UiSelector[CLASS=android.widget.LinearLayout, RESOURCE_ID=com.instagram.android:id/row_profile_header_followers_container]
I experienced an issue, my script crash after 'double click' in the comments section instead of the actual photo/video.
My guess is that depending on the device you use, the coordinates of the action taken by the script (e.g. double click) are different. For example, I have a Huawei P30 Pro with a very big screen, the not square sized photos/videos shown a way higher than the center of my screen. Then, during the 'double click' action for liking it seems to click on the comments/description (e.g. on hashtags) when the photo/video is not square sized.
A solution may be to get dynamic coordinates from the photos/videos (or maybe to know what size they are) before 'double clicking' to adjust where the 'double click' happens.
I'm really excited to make this project work. When running the script everything looks smooth. However, nothing happens. Any pointers as to where to start for troubleshooting? Thank you!
_[06/26 14:33:55] Connected devices via adb: 1. That's ok.
usage: insomniac.py [--interact usta [playyourcourt ...]] [--likes-count 2] [--total-likes-limit 1000] [--interactions-count 100] [--repeat 180] [--follow-percentage 50] [--unfollow 100] [--unfollow-non-followers 100]
Instagram bot for automated Instagram interaction using Android device via ADB
optional arguments:
--interact usta [playyourcourt ...]
list of usernames with whose followers you want to interact
--likes-count 2 number of likes for each interacted user, 2 by default
--total-likes-limit 1000
limit on total amount of likes during the session, 1000 by default
--interactions-count 100
number of interactions per each blogger, 100 by default
--repeat 180 repeat the same session again after N minutes after completion, disabled by default
--follow-percentage 50
follow given percentage of interacted users, 0 by default
--unfollow 100 unfollow at most given number of users. Only users followed by this script will be unfollowed. The order is from oldest to newest followings
--unfollow-non-followers 100
unfollow at most given number of users, that don't follow you back. Only users followed by this script will be unfollowed. The order is from oldest to newest followings_
Hello guys, I tried installing/using on Ubuntu mate and Windows without success.
On Ubuntu getting some key error and on Windows 0 devices connected. Do I have to root the Android device? I m using a LG k10 LTE with Android 6.0
Do I have to do something to make it work? Followed all steps and got no success.
Hope you help me, thank you.
Impossible to show the bug, it only appears on the phone screen but not on the cmd.
randomly, it goes on the phone galerie.
(even one time on my own profile, i can suppose that is "normal" to make a more human interaction like said in the notice)
I suppose that it's press the wrong key,
(the "+" instead of "back" or "search" key)
the script continue as nothing happens but the phone is totally elsewhere than it should be...
maybe resolution of the screen is different as it suppose to be in the script?
I see a nice pullrequest from 3 days ago for hashtag support!
Thx @dwai03
I tested it and works! Why isn't it been pulled?
Thats how instapy got big, community! I do see updates from today, but pullrequests being ingored?
Is there a possibility to validate whether an account is a business account before interacting with it?
Again, more a request but haven't capacity to program it.
Something like;
if no post, 1/2 post, or if private account > send "private message" (to reach inaccessible account)
randomly send > "private message"
randomly > post "comment"
The bot works like a charm, in the state of work in progress that's a really good begining.
Maybe a video/notice is needed to really understand how to install and make it works.
In my case, the bot interact with other profiles but don't put any like,
it's just go on the profile, check it, scroll down and come back to followers list
Any advice?
I also used 2 days ago InstaPy and happened the same. Even with proxy and different ips.
Its always show Following status: NONE. Although i use command --unfollow and --unfollow-non-followers
As @GabrieleAnsaldo commented on Telegram Group "This comes usefull if for instance you keep your phone connected whole time, consider on and off"
Open as issue to discuss and follow implementation.
This error comes up when attaching my phone to the raspberry pi.
Any clues what's going wrong?
Please delete this post.
Maybe more a request than a bug/issue.
But when you check followers of someone with lot of followers, if a bug appears or you just don't want the script runs h24..
You get that....
So maybe thinking about to take more randomzed interactions than one by one?
And by the way, 2 likes per profile is really short, in my case i constat that it needs at least 6 to 15 likes on one profile to have interest. (i know we can change that in the scritpt)
Traceback (most recent call last):
File "insomniac.py", line 335, in <module>
main()
File "insomniac.py", line 91, in main
int(args.follow_limit),
TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'
I guess you could open and close Instagram with the following code:
import os
# Open Instagram
os.system("adb shell monkey -p com.instagram.android 1 -")
# Close Instagram
os.system("adb shell am force-stop com.instagram.android")
Also, you could add a function that goes through the Recent page of a certain hashtag and starts liking a certain number of pictures.
You could make various functions of possible actions that you can do:
I was thinking about how the following part could be implemented. Basically Instagram lets you go to your following page and see your followers ordered from the person you followed the latest. So basically if you follow 5 ppl you could just unfollow the latest 5 people. That's an idea. Otherwise, a slower process would be the one of going to each user's page and click the unfollow button.
Let me know if I could help somehow.
[07/14 19:54:31] Open Instagram app
[07/14 19:54:33] Sleep for 2 seconds
[07/14 19:54:35] Press profile
[07/14 19:54:42] Failed to get username
Traceback (most recent call last):
File "insomniac.py", line 369, in
main()
File "insomniac.py", line 81, in main
storage = Storage(session_state.my_username)
File "/home/pi/Insomniac/src/storage.py", line 17, in init
os.makedirs(my_username)
File "/usr/lib/python3.7/os.py", line 221, in makedirs
mkdir(name, mode)
FileNotFoundError: [Errno 2] No such file or directory: ''
Dear, good afternoon.! My samsung s6 device after an internet outage started to throw the following error after entering the first follower to look at their photos. This is recurring, that is, it reaches the first follower and throws that message. Any ideas?
python insomniac.py --interact comerennuevacordoba --likes-count 3 --total-likes-limit 200
`C:\Users\usuario\Desktop\samsung\Insomniac>python insomniac.py --interact comerennuevacordoba --likes-count 3 --total-likes-limit 200
Insomniac v1.5.1
Action: interact with @comerennuevacordoba
-------- START: 2020-06-28 16:26:17.618545 --------
Open Instagram app
Sleep for 2 seconds
Press profile
Hello, @bokurajeanscba
Handle @comerennuevacordoba
Press search
Open user @comerennuevacordoba
Open @comerennuevacordoba followers
Iterate over visible followers
@eltallerdeltequenio: interact
Sleep for 4 seconds
Scroll down to see more photos.
Screenshot taken and saved as Crash-2020-06-28-16-31-26.png
TOTAL
Completed sessions: 0
Total duration: 0:05:12.256446
Total interactions: 0
Successful interactions: 0
Total likes: 0
Total followed: 0
Total unfollowed: 0
Traceback (most recent call last):
File "C:\Users\usuario\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connectionpool.py", line 426, in _make_request
six.raise_from(e, None)
File "", line 3, in raise_from
File "C:\Users\usuario\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connectionpool.py", line 421, in _make_request
httplib_response = conn.getresponse()
File "C:\Users\usuario\AppData\Local\Programs\Python\Python38\lib\http\client.py", line 1332, in getresponse
response.begin()
File "C:\Users\usuario\AppData\Local\Programs\Python\Python38\lib\http\client.py", line 303, in begin
version, status, reason = self._read_status()
File "C:\Users\usuario\AppData\Local\Programs\Python\Python38\lib\http\client.py", line 264, in _read_status
line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
File "C:\Users\usuario\AppData\Local\Programs\Python\Python38\lib\socket.py", line 669, in readinto
return self._sock.recv_into(b)
socket.timeout: timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "insomniac.py", line 342, in
main()
File "insomniac.py", line 77, in main
_job_handle_bloggers(device,
File "insomniac.py", line 152, in _job_handle_bloggers
raise e
File "insomniac.py", line 133, in _job_handle_bloggers
handle_blogger(device, username, likes_count, follow_percentage, storage, _on_like, on_interaction)
File "C:\Users\usuario\Desktop\samsung\Insomniac\action_handle_blogger.py", line 26, in handle_blogger
_iterate_over_followers(device, interaction, storage, on_interaction, is_myself)
File "C:\Users\usuario\Desktop\samsung\Insomniac\action_handle_blogger.py", line 120, in _iterate_over_followers
interaction_succeed, followed = interaction(device, username=username, can_follow=can_follow)
File "C:\Users\usuario\Desktop\samsung\Insomniac\action_handle_blogger.py", line 164, in interact_with_user
if not scroll_profile(device):
File "C:\Users\usuario\Desktop\samsung\Insomniac\action_handle_blogger.py", line 256, in scroll_profile
profile_tabs_container_top = profile_tabs_container.bounds['top']
File "C:\Users\usuario\AppData\Local\Programs\Python\Python38\lib\site-packages\uiautomator_init.py", line 934, in getattr
info = self.info
File "C:\Users\usuario\AppData\Local\Programs\Python\Python38\lib\site-packages\uiautomator_init.py", line 945, in info
return self.jsonrpc.objInfo(self.selector)
File "C:\Users\usuario\AppData\Local\Programs\Python\Python38\lib\site-packages\uiautomator_init.py", line 443, in wrapper
return JsonRPCMethod(url, method, timeout, False)(*args, **kwargs)
File "C:\Users\usuario\AppData\Local\Programs\Python\Python38\lib\site-packages\uiautomator_init.py", line 438, in wrapper
return method_obj(*args, **kwargs)
File "C:\Users\usuario\AppData\Local\Programs\Python\Python38\lib\site-packages\uiautomator_init.py", line 115, in call
res = self.pool.urlopen("POST",
File "C:\Users\usuario\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\poolmanager.py", line 336, in urlopen
response = conn.urlopen(method, u.request_uri, **kw)
File "C:\Users\usuario\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connectionpool.py", line 724, in urlopen
retries = retries.increment(
File "C:\Users\usuario\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\util\retry.py", line 403, in increment
raise six.reraise(type(error), error, _stacktrace)
File "C:\Users\usuario\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\packages\six.py", line 735, in reraise
raise value
File "C:\Users\usuario\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connectionpool.py", line 670, in urlopen
httplib_response = self._make_request(
File "C:\Users\usuario\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connectionpool.py", line 428, in _make_request
self._raise_timeout(err=e, url=url, timeout_value=read_timeout)
File "C:\Users\usuario\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connectionpool.py", line 335, in _raise_timeout
raise ReadTimeoutError(
urllib3.exceptions.ReadTimeoutError: HTTPConnectionPool(host='localhost', port=9009): Read timed out. (read timeout=90)
C:\Users\usuario\Desktop\samsung\Insomniac>`
I already tried everything, I even did a full reset and everything remains the same, it goes into the first follower and dies there. The strange thing is that the rest of my devices work perfectly.
Suggestions?
Hello guys !!
The problem occurs when Insomniac wants to track an account that was previously tracked manually or without the script. Clicking the "Next" button opens the options window and interrupts the process.
I think there could be two possible options.
1- Press the Back button when that window opens
2- That insomniac detects that you are already following it and you do not press the "Next" button
Any questions, I am available
Regards!
import PySimpleGUI as sg
#sg.theme('Dark Brown 1')
sg.SetOptions(element_padding=(0, 0))
devicesLabel = [[sg.Text('Device')] + [sg.Text(size=(14,1))]]
devices = [[sg.Listbox(values=('Device 1', 'Device 2', 'Device 3'), size=(30, 3))]]
bloggersLabel = [[sg.Text('Bloggers')] + [sg.Text(size=(14,1))]]
bloggers = [[sg.MLine(default_text='Loading your bloggers here', size=(30, 3))]]
interactionsLabel = [[sg.Text('Interact user per blogger')] + [sg.Text(size=(14,1))]]
interactions = [[sg.Slider(range=(0,255),default_value=1,orientation='h',size=(30, 20))]]
sleepLabel = [[sg.Text('Sleep after session')] + [sg.Text(size=(14,1))]]
activateSleep = [[sg.Frame('Activate sleep:',[[sg.Radio('Enable', "RADIO1", default=True, size=(7, 1))],
[sg.Radio('Disable', "RADIO1")]
+ [sg.Text(size=(12,1))]])]]
sleep = [[sg.Slider(range=(0,1000),default_value=180,orientation='h',size=(30, 20))]]
button = [[sg.Button('Start Insomniac')]]
howUse = [[sg.Frame('How use:',[[sg.Text('1 - Select your device.')],
[sg.Text('2 - Select your bloggers.(Enter to next)')],
[sg.Text('3 - Select interactions per bloggers.')],
[sg.Text('4 - Select sleep after session.')],
[sg.Text('5 - Start Insomniac.')]
+ [sg.Text(size=(12,1))]])]]
about = [[sg.Frame('About:',
[[sg.Text('Insomniac 2.0')],
[sg.Text('https://github.com/alexal1/Insomniac',)],
[sg.Text('Free and Opensource',)]
+ [sg.Text(size=(12,1))]])]]
layout = devicesLabel + devices + bloggersLabel + bloggers + interactionsLabel + interactions + sleepLabel + sleep + activateSleep + button + howUse + about
window = sg.Window('Insomniac 2.0', layout, font='Courier 12')
event, values = window.read()
while True:
event, values = window.read()
if event in (sg.WIN_CLOSED, 'Cancel'):
break
window.close()
https://pysimplegui.readthedocs.io/en/latest/
Opening it as issue if someone can help on implementing a simply interface to all usage.
Thank you.
�[91mTraceback (most recent call last):
File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\uiautomator\__init__.py", line 438, in wrapper
return _method_obj(*args, **kwargs)
File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\uiautomator\__init__.py", line 135, in __call__
"%s: %s" % (jsonresult["error"]["data"]["exceptionTypeName"], jsonresult["error"]["message"])
uiautomator.JsonRPCError: JsonRPC Error code: -32002, Message: android.support.test.uiautomator.UiObjectNotFoundException: UiSelector[CLASS=android.widget.FrameLayout, RESOURCE_ID=com.instagram.android:id/action_bar_container]
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "insomniac.py", line 89, in _job_handle_bloggers
handle_blogger(device, blogger, likes_count, storage, _on_like, on_interaction)
File "C:\Users\User\Downloads\Insomniac2\action_handle_blogger.py", line 18, in handle_blogger
_iterate_over_followers(device, interaction, storage, on_interaction)
File "C:\Users\User\Downloads\Insomniac2\action_handle_blogger.py", line 69, in _iterate_over_followers
interaction_succeed = interaction(device)
File "C:\Users\User\Downloads\Insomniac2\action_handle_blogger.py", line 109, in _interact_with_user
if not _open_photo_and_like(device, row, column, on_like):
File "C:\Users\User\Downloads\Insomniac2\action_handle_blogger.py", line 143, in _open_photo_and_like
action_bar_bottom = action_bar.bounds['bottom']
File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\uiautomator\__init__.py", line 934, in __getattr__
info = self.info
File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\uiautomator\__init__.py", line 945, in info
return self.jsonrpc.objInfo(self.selector)
File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\uiautomator\__init__.py", line 458, in wrapper
return _method_obj(*args, **kwargs)
File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\uiautomator\__init__.py", line 135, in __call__
"%s: %s" % (jsonresult["error"]["data"]["exceptionTypeName"], jsonresult["error"]["message"])
uiautomator.JsonRPCError: JsonRPC Error code: -32002, Message: android.support.test.uiautomator.UiObjectNotFoundException: UiSelector[CLASS=android.widget.FrameLayout, RESOURCE_ID=com.instagram.android:id/action_bar_container]
�[0m
Try again for @codes.learning from the beginning
Think that you found a way to handle IGTV BUG but i still getting this error message on this solution. Can you also handle this message?
Thank you!
first time running and it goes fast sure it wont get blocked? anyway to add a custom sleep function ?
Hello good afternoon.
My name is Jonathan, I am from Argentina, I have used Instapy for a long time, but then, when observing that web bots are very detectable, I gave up on the idea and started doing the same job manually using android simulators. (Currently I work with 10 accounts, 2 accounts for each simulator) Looking at your INSOMNE system, I find it very interesting and I am going to test it. Only one thing that I could not visualize in the code, does it have the functionality to follow followers of predefined users?
Thank you very much for your contribution and apologies for my English: p
EDIT: Solved by reinstalling the app
i'm stuck on this fase, all work ok, but during open followers this error appears:
File "/.../python3.8/site-packages/uiautomator/init.py", line 133, in call
raise JsonRPCError(
uiautomator.JsonRPCError: JsonRPC Error code: -32002, Message: android.support.test.uiautomator.UiObjectNotFoundException: UiSelector[CLASS=android.widget.LinearLayout, RESOURCE_ID=com.instagram.android:id/row_profile_header_followers_container]
PS: the program seems AWESOME
Traceback (most recent call last):
File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\connectionpool.py", line 421, in _make_request
six.raise_from(e, None)
File "<string>", line 3, in raise_from
File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\connectionpool.py", line 416, in _make_request
httplib_response = conn.getresponse()
File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\http\client.py", line 1336, in getresponse
response.begin()
File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\http\client.py", line 306, in begin
version, status, reason = self._read_status()
File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\http\client.py", line 267, in _read_status
line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\socket.py", line 589, in readinto
return self._sock.recv_into(b)
socket.timeout: timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "insomniac.py", line 221, in <module>
main()
File "insomniac.py", line 49, in main
_job_handle_bloggers(device, args.bloggers, int(args.likes_count), storage, on_interaction)
File "insomniac.py", line 105, in _job_handle_bloggers
raise e
File "insomniac.py", line 89, in _job_handle_bloggers
handle_blogger(device, blogger, likes_count, storage, _on_like, on_interaction)
File "C:\Users\User\Downloads\Insomniac2\action_handle_blogger.py", line 18, in handle_blogger
_iterate_over_followers(device, interaction, storage, on_interaction)
File "C:\Users\User\Downloads\Insomniac2\action_handle_blogger.py", line 69, in _iterate_over_followers
interaction_succeed = interaction(device)
File "C:\Users\User\Downloads\Insomniac2\action_handle_blogger.py", line 109, in _interact_with_user
if not _open_photo_and_like(device, row, column, on_like):
File "C:\Users\User\Downloads\Insomniac2\action_handle_blogger.py", line 143, in _open_photo_and_like
action_bar_bottom = action_bar.bounds['bottom']
File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\uiautomator\__init__.py", line 934, in __getattr__
info = self.info
File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\uiautomator\__init__.py", line 945, in info
return self.jsonrpc.objInfo(self.selector)
File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\uiautomator\__init__.py", line 443, in wrapper
return _JsonRPCMethod(url, method, timeout, False)(*args, **kwargs)
File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\uiautomator\__init__.py", line 438, in wrapper
return _method_obj(*args, **kwargs)
File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\uiautomator\__init__.py", line 119, in __call__
timeout=self.timeout)
File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\poolmanager.py", line 330, in urlopen
response = conn.urlopen(method, u.request_uri, **kw)
File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\connectionpool.py", line 720, in urlopen
method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\util\retry.py", line 400, in increment
raise six.reraise(type(error), error, _stacktrace)
File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\packages\six.py", line 735, in reraise
raise value
File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\connectionpool.py", line 672, in urlopen
chunked=chunked,
File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\connectionpool.py", line 423, in _make_request
self._raise_timeout(err=e, url=url, timeout_value=read_timeout)
File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\connectionpool.py", line 331, in _raise_timeout
self, url, "Read timed out. (read timeout=%s)" % timeout_value
urllib3.exceptions.ReadTimeoutError: HTTPConnectionPool(host='localhost', port=9008): Read timed out. (read timeout=90)
We need something to bypass connection lost message and try again.
Thank you.
Me again,
have a traceback that making a loop in the interacted users
The bot just like and re-like the same pics of the same profile after getting the error.
Saw that the "interacted_users.txt" doesn't update anymore when user job is done.
Screen under.
I'll test with a brand new vanilla download of the script tomorrow (UTM+1 for me)
(in the case that differents devices used creates a conflict)
Hello @alexal1 .
I noticed some strange behavior with some video posts.
It opens the video post then sleep for some seconds and before the double tap stack trace below
Sleep for 4 seconds
Traceback (most recent call last):
File "/home/pi/.local/lib/python3.5/site-packages/uiautomator/__init__.py", line 438, in wrapper
return _method_obj(*args, **kwargs)
File "/home/pi/.local/lib/python3.5/site-packages/uiautomator/__init__.py", line 127, in __call__
result = urllib2.urlopen(req, timeout=self.timeout)
File "/usr/lib/python3.5/urllib/request.py", line 163, in urlopen
return opener.open(url, data, timeout)
File "/usr/lib/python3.5/urllib/request.py", line 466, in open
response = self._open(req, data)
File "/usr/lib/python3.5/urllib/request.py", line 484, in _open
'_open', req)
File "/usr/lib/python3.5/urllib/request.py", line 444, in _call_chain
result = func(*args)
File "/usr/lib/python3.5/urllib/request.py", line 1282, in http_open
return self.do_open(http.client.HTTPConnection, req)
File "/usr/lib/python3.5/urllib/request.py", line 1257, in do_open
r = h.getresponse()
File "/usr/lib/python3.5/http/client.py", line 1198, in getresponse
response.begin()
File "/usr/lib/python3.5/http/client.py", line 297, in begin
version, status, reason = self._read_status()
File "/usr/lib/python3.5/http/client.py", line 258, in _read_status
line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
File "/usr/lib/python3.5/socket.py", line 576, in readinto
return self._sock.recv_into(b)
socket.timeout: timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "insomniac.py", line 90, in _job_handle_bloggers
handle_blogger(device, blogger, likes_count, storage, _on_like, on_interaction)
File "/home/pi/workspace/insomniac/action_handle_blogger.py", line 18, in handle_blogger
_iterate_over_followers(device, interaction, storage, on_interaction)
File "/home/pi/workspace/insomniac/action_handle_blogger.py", line 69, in _iterate_over_followers
interaction_succeed = interaction(device)
File "/home/pi/workspace/insomniac/action_handle_blogger.py", line 114, in _interact_with_user
if not _open_photo_and_like(device, row, column, on_like):
File "/home/pi/workspace/insomniac/action_handle_blogger.py", line 148, in _open_photo_and_like
action_bar_bottom = action_bar.bounds['bottom']
File "/home/pi/.local/lib/python3.5/site-packages/uiautomator/__init__.py", line 934, in __getattr__
info = self.info
File "/home/pi/.local/lib/python3.5/site-packages/uiautomator/__init__.py", line 945, in info
return self.jsonrpc.objInfo(self.selector)
File "/home/pi/.local/lib/python3.5/site-packages/uiautomator/__init__.py", line 443, in wrapper
return _JsonRPCMethod(url, method, timeout, False)(*args, **kwargs)
File "/home/pi/.local/lib/python3.5/site-packages/uiautomator/__init__.py", line 438, in wrapper
return _method_obj(*args, **kwargs)
File "/home/pi/.local/lib/python3.5/site-packages/uiautomator/__init__.py", line 127, in __call__
result = urllib2.urlopen(req, timeout=self.timeout)
File "/usr/lib/python3.5/urllib/request.py", line 163, in urlopen
return opener.open(url, data, timeout)
File "/usr/lib/python3.5/urllib/request.py", line 466, in open
response = self._open(req, data)
File "/usr/lib/python3.5/urllib/request.py", line 484, in _open
'_open', req)
File "/usr/lib/python3.5/urllib/request.py", line 444, in _call_chain
result = func(*args)
File "/usr/lib/python3.5/urllib/request.py", line 1282, in http_open
return self.do_open(http.client.HTTPConnection, req)
File "/usr/lib/python3.5/urllib/request.py", line 1257, in do_open
r = h.getresponse()
File "/usr/lib/python3.5/http/client.py", line 1198, in getresponse
response.begin()
File "/usr/lib/python3.5/http/client.py", line 297, in begin
version, status, reason = self._read_status()
File "/usr/lib/python3.5/http/client.py", line 258, in _read_status
line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
File "/usr/lib/python3.5/socket.py", line 576, in readinto
return self._sock.recv_into(b)
socket.timeout: timed out
I can't seem to enter the right arguments to make unfollowing work. I keep receiving the error "Running Insomniac with two or more actions is not supported yet." Could you please help?
I have the following arguments and run the following command
Command:
python insomniac.py --unfollow-non-followers 100
Arguments:
parser.add_argument('--interact',
nargs='+',
help='list of usernames with whose followers you want to interact',
metavar=(''),
default=[''])
parser.add_argument('--likes-count',
help='number of likes for each interacted user, 2 by default',
metavar='',
default=0)
parser.add_argument('--total-likes-limit',
help='limit on total amount of likes during the session, 1000 by default',
metavar='',
default=0)
parser.add_argument('--interactions-count',
help='number of interactions per each blogger, 100 by default',
metavar='',
default=0)
parser.add_argument('--repeat',
help='repeat the same session again after N minutes after completion, disabled by default',
metavar='')
parser.add_argument('--follow-percentage',
help='follow given percentage of interacted users, 0 by default',
metavar='',
default=0)
parser.add_argument('--unfollow',
help='unfollow at most given number of users. Only users followed by this script will '
'be unfollowed. The order is from oldest to newest followings',
metavar='',
default='0')
parser.add_argument('--unfollow-non-followers',
help='unfollow at most given number of users, that don't follow you back. Only users followed '
'by this script will be unfollowed. The order is from oldest to newest followings',
metavar='100',
default='100')
As @GabrieleAnsaldo commented on Telegram Group "For a natural behavior"
https://schedule.readthedocs.io/en/stable/
Open as issue to discuss and follow implementation.
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.