Closed GabrieleAnsaldo closed 4 years ago
Other things that could be added:
@GabrieleAnsaldo thanks for ideas, they are really great! Definitely all of them should be implemented. I just don't have much time, so will have to prioritize them. Following is the most important now, isn't it?
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.
It's better to divide two processes: following and unfollowing. It gives more flexibility. If you want to do one immediately after another, you can run shell script like
# Unfollow all users previously followed by the script
pyhton insomniac.py --unfollow
# Follow 50% of interacted users
python --bloggers username1 --follow-percentage 50
Why going to each user's page? We can unfollow by buttons on the followings page.
P.S. I will VERY appreciate if you make pull requests. I see that you have great ideas and this script was originally your idea, I just applied UI Automator tool.
Thank you guys! Any idea to unfollow non followers?
@gvmturl a bit more tricky, but algorithm can be the following: iterate over followings -> open each following -> go to his/her followings -> if you are followed back, you are on the first row -> return back and unfollow if not followed back -> return back to followings
So we can create such flags:
# Unfollow all users followed by the script
python insomniac.py --unfollow
# Unfollow all users followed by the script, 100 at most during the session
python insomniac.py --unfollow 100
# Unfollow all non-followers followed by the script
python insomniac.py --unfollow-non-followers
# Unfollow all non-followers followed by the script, 100 at most during the session
python insomniac.py --unfollow-non-followers 100
Okay, thanks for the answer @alexal1! Tonight I will try to work on it a bit and send a pull request so that you can review it! I will try and make as many changes as possible.
Also, I am kinda new to UI Automator, I had a hard time looking for documentation. Do you have any suggestions on where I can find some examples and or documentation on how to use it properly?
@GabrieleAnsaldo of course, all you need is
resourceId
and className
of UI elements there.
The uiautomatorviewer tool provides a convenient GUI to scan and analyze the UI components currently displayed on an Android device. You can use this tool to inspect the layout hierarchy and view the properties of UI components that are visible on the foreground of the device. This information lets you create more fine-grained tests using UI Automator, for example by creating a UI selector that matches a specific visible property.
The uiautomatorviewer tool is located in the
/tools/bin directory.
https://developer.android.com/training/testing/ui-automator
some_view = device(resourceId='...', className='...')
some_view.click.wait()
@gvmturl a bit more tricky, but algorithm can be the following: iterate over followings -> open each following -> go to his/her followings -> if you are followed back, you are on the first row -> return back and unfollow if not followed back -> return back to followings
So we can create such flags:
# Unfollow all users followed by the script python insomniac.py --unfollow # Unfollow all users followed by the script, 100 at most during the session python insomniac.py --unfollow 100 # Unfollow all non-followers followed by the script python insomniac.py --unfollow-non-followers # Unfollow all non-followers followed by the script, 100 at most during the session python insomniac.py --unfollow-non-followers 100
@alexal1 Thank you for replying, i will be waiting for this update...any solution for skipping private users?
Other things that could be added:
- Telegram connection so that you get notifications of how the bot is behaving when it is running ( in the case you are using an old android phone as a permanent Instagram bot)
- The package schedule could be used to schedule the various actions at specific times during the day
@GabrieleAnsaldo please let us know when telegram integration is complete.
Could you add the command list to telegramBot as variables define as such flags defined on that script or something to autoadd IG functions to telegram? Also could be defined a variable as comment on IG Function that completes ¨HELP¨ function on telegram.
Is there anyway to storage all errors into a log? Like IndexError? I got this error here but script still running...
Is everything working with IGTV Videos? I Just seem it entered on a long video here... i will keep checking it... isn't better open a Bug reports as a issue or is there any better way to report that bugs here?
Thank you
@gvmturl actually skipping private users works already (in not a very optimal way though). Algorithm tries to open a photo to like it. If it can't – it scrolls (on some devices screen's height is too small and photos are not visible). If it can't again – it skips user.
I don't know any way to detect private users without opening their profiles.
Is there anyway to storage all errors into a log? Like IndexError? I got this error here but script still running...
@gvmturl this error occurs when opened screen is not the one the script expects. This happens sometimes, I fix these bugs as I can. Don't forget to git pull
sometimes. Script continues working because the other way such sudden stops would be frustrating. It starts current "blogger" from the beginning, so it's kind of "autofix" :)
If you have some time to implement logging errors – it would be fantastic! Feel free to make PRs. I personally gonna do some more prioritized features first.
isn't better open a Bug reports as a issue or is there any better way to report that bugs here?
Yeah, creating separate bug issues would be great!
Good news folks! @GabrieleAnsaldo @gvmturl
I've implemented Open and Close Instagram in 6eaa73997171db46827ddf04f84796e638004512, so I'm closing this issue now.
I also added --repeat 180
argument which makes the script to restart the session with exactly same settings in 180 minutes after completion. It continues indefinitely, until you stop the script by control+C. Instagram app is automatically being closed between sessions. This feature is disabled by default, until you add --repeat N
argument.
So don't forget to git pull
and enjoy. Thanks for this discussion, if you have more ideas to add, please create separate Issues. It will help me to work on the script more efficient.
Hello @alexal1 i m still trying how everything works on this project to start helping on it...
could you explain me please where did you dump to get to get com.instagram.android/com.instagram.mainactivity.MainActivity
i see that originaly suggested @GabrieleAnsaldo using
os.system("adb shell monkey -p com.instagram.android 1 -")
but you you used
os.popen("adb shell am start -n com.instagram.android/com.instagram.mainactivity.MainActivity").close()
Could you explain me why you made it and what does it means...
I will be attentive to your comments.
Thank you.
I guess you could open and close Instagram with the following code:
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.