[Free bot] Free Instagram bot for your Raspberry Pi

Thanks so much for this!
I just got my Pi and wanted it to do more stuff.

I am having issues starting the bot however, it says:


23.05.2018_00:47 Instabot v1.2.0 started at 23.05.2018 00:47:
"23.05.2018_00:47 Trying to login as XXX...
Traceback (most recent call last):
File "/home/pi/bot/instabot.py/followbot.py", line 52, in
unfollow_whitelist=['example_user_1', 'example_user_2'])
File "/home/pi/bot/instabot.py/src/instabot.py", line 232, in init
self.login()
File "/home/pi/bot/instabot.py/src/instabot.py", line 283, in login
self.s.headers.update({'X-CSRFToken': r.cookies['csrftoken']})
File "/usr/local/lib/python2.7/dist-packages/requests/cookies.py", line 329, in getitem
return self._find_no_duplicates(name)
File "/usr/local/lib/python2.7/dist-packages/requests/cookies.py", line 400, in _find_no_duplicates
raise KeyError('name=%r, domain=%r, path=%r' % (name, domain, path))
KeyError: "name='csrftoken', domain=None, path=None""
What are these errors and how do I fix it? Also how do I tell if the bot is running?
Thanks!
 
Ah, I think I used the official Github so thought that was the latest, thanks will check out this one. :)
 
So I jsut tried using that Github and reinstall their version, I now have the following error:
Traceback (most recent call last):
File "/home/pi/bot/InstabotOK/followbot.py", line 6, in <module>
from src import InstaBot
File "/home/pi/bot/InstabotOK/src/__init__.py", line 1, in <module>
from .instabot import InstaBot
File "/home/pi/bot/InstabotOK/src/instabot.py", line 25, in <module>
class InstaBot:
File "/home/pi/bot/InstabotOK/src/instabot.py", line 102, in InstaBot
logging.basicConfig(filename='errors.log', level=logging.INFO)
File "/usr/lib/python2.7/logging/__init__.py", line 1547, in basicConfig
hdlr = FileHandler(filename, mode)
File "/usr/lib/python2.7/logging/__init__.py", line 913, in __init__
StreamHandler.__init__(self, self._open())
File "/usr/lib/python2.7/logging/__init__.py", line 943, in _open
stream = open(self.baseFilename, self.mode)
IOError: [Errno 13] Permission denied: '/home/pi/b

Thanks for your help so far! :)
 
Oh right, i forgot, I tried that and now it gives me the first error again
Should I install or changed anything else?
all I did differently is cloned the other Github that you provided and other steps were the same, I know this is a new one as the likes per day is now 500 instead of 1k.
Any ideas?
23.05.2018_20:35 Instabot v1.2.0 started at 23.05.2018 20:35:

23.05.2018_20:35 Trying to login as hxxx...

Traceback (most recent call last):
File "/home/pi/bot/InstabotOK/followbot.py", line 52, in <module>
unfollow_whitelist=['example_user_1', 'example_user_2'])
File "/home/pi/bot/InstabotOK/src/instabot.py", line 235, in __init__
self.login()
File "/home/pi/bot/InstabotOK/src/instabot.py", line 287, in login
self.s.headers.update({'X-CSRFToken': r.cookies['csrftoken']})
File "/usr/local/lib/python2.7/dist-packages/requests/cookies.py", line 329, i
n __getitem__
return self._find_no_duplicates(name)
File "/usr/local/lib/python2.7/dist-packages/requests/cookies.py", line 400, i
n _find_no_duplicates
raise KeyError('name=%r, domain=%r, path=%r' % (name, domain, path))
KeyError: "name='csrftoken', domain=None, path=None"

Thanks!
 
Yep, I seen this too, one of the guy posted on my issue, but I'm not sure where to add this? To the example file? If in there, where??
napster2091commented 13 hours ago•edited
I wrote this solution and it works for me:
response = self.s.get(ICANNOTPOSTLINK)
if response.status_code == 404:
return
resp = response.text
if resp is not None and '_sharedData' in resp:
try:
shared_data = json.loads(resp.split("window._sharedData = ")[1].split(";</script>")[0])
except (TypeError, KeyError, IndexError):
pass
self.csrftoken = shared_data['config']['csrf_token']
Inside self.csrftoken you have the value you need to put in the header before doing the login POST request
self.s.headers.update({'X-CSRFToken': self.csrftoken})
login = self.s.post(self.url_login, data=self.login_post)

Thanks once more :)
 
I believe they are referring to the source file of instabot.py (src/instabot.py)
 
I believe they are referring to the source file of instabot.py (src/instabot.py)
Hi again, I tried looking for this file but I'm not sure?
I only see a srv folder not a src folder, where is this source file?
Thanks and sorry for ignorance
 
@wily
Hey I know maybe it's a bit late with this reply, but now I also got this problem (had to log out of my account for a reason). I fixed the issue by modifying the instabot.py located in the src.
What I changed is as follow:

add this line of code at the top of your file just below one of the imports:
Code:
import re

now it should look something like
Code:
import atexit
import datetime
import itertools
import json
import re
import logging
import random
import signal
import sys
import sqlite3
import time
import requests

Once you have done that search for this line:
Code:
self.s.headers.update({'X-CSRFToken': r.cookies['csrftoken']})

Replace that line with:
Code:
#self.s.headers.update({'X-CSRFToken': r.cookies['csrftoken']})
csrf_token = re.search('(?<=\"csrf_token\":\")\w+', r.text).group(0)
self.s.headers.update({'X-CSRFToken': csrf_token})

Please take a good note to the indenting (spaces) of the file as Python may nag you about it if you do this wrong.
Hope this helps!
 
Thank you very much for this tutorial!

I do have hopefully a quick couple of questions.

1. When I launch python /home/pi/bot/instabot.py/followbot.py it launches as I would assume it should and I get a rolling screen of updates every few seonds
- My first message after trying to login as [username] I get the message "Login error! Check your login data!," but I only get it once. It's not persistent, but it goes into "Removing already liked medias, and just roles through that persistently. Is this normal, or have I not appropriately edited my "likes" list?
2. should it just continually state "Removing already like medias.." or should I see additional messages in this log?

Thanks
 
Thank you very much for this tutorial!

I do have hopefully a quick couple of questions.

1. When I launch python /home/pi/bot/instabot.py/followbot.py it launches as I would assume it should and I get a rolling screen of updates every few seonds
- My first message after trying to login as [username] I get the message "Login error! Check your login data!," but I only get it once. It's not persistent, but it goes into "Removing already liked medias, and just roles through that persistently. Is this normal, or have I not appropriately edited my "likes" list?
2. should it just continually state "Removing already like medias.." or should I see additional messages in this log?

Thanks
1. I assume you have wrong login data, I never had this issue before after inserting the correct data.
2. This isn't right, it could be that the likes for that tag are already maxed out. Either try new tags or increase the amount of likes per tag.

Good idea. Thank man
You're welcome :)
 
I've confirmed login credentials. This is my first expedition into python, so there is a possibility that I'm messing something up. Right now I have my username, and my password in "quotations" and it's pretty cut and dry on the information entered...My initial attempt is using my phone number, but I am going to attempt with my e-mail in the login/username slot in just a moment.

I'm not certain that I've maxed out on likes yet...I've just started running the script today on a pi within the last half an hour. ;) I do believe that issue 2 is stemming from issue 1 as well though, so I am going to attempt revising my followbot.py file again.

Thank you again for the ridiculously fast response!!
 
I may have just resolved my predicament. I was using e-mail, and phone number, but entering in my @username did the trick ;)

I'm now getting messages that look more normal.

"Trying to like media: [numbers]"
"Liked: [numbers]/ Like #1"
 
I may have just resolved my predicament. I was using e-mail, and phone number, but entering in my @username did the trick ;)

I'm now getting messages that look more normal.

"Trying to like media: [numbers]"
"Liked: [numbers]/ Like #1"
If the numbers of like keep incrementing it's working properly. :) good job.
 
really neat little tutorial. thank you, i've not encountered rasperry pi yet but its something im going to be looking at for one of my businesses.
 
awesome share mate! I was literally learning about rapberry pi because of this thing for few hours. glad I found this thread!
 
Hi thank you for sharing.

I am not able to resolve this error. (The attribute error)
It keeps popping up after: Trying to login as username...

Traceback (most recent call last):
File "/home/pi/instaBlackhatBo/instabot.py/followbot.py", line 46, in <module>
unfollow_whitelist=['personone', 'persontwo', 'anotherperson'])
File "/home/pi/instaBlackhatBo/instabot.py/followbot.py", line 234, in __init__
self.login()
File "/home/pi/instaBlackhatBo/instabot.py/followbot.py", line 303, in login
self.user_id = ui.get_user_id_by_login(self.user_login)
File "/home/pi/instaBlackhatBo/instabot.py/followbot.py", line 42, in get_user_id_by_login
json_info = json.loads(re.search('{"activity.+show_app', info.text, re.DOTALL).group(0)+'"":""}'
AttributeError: 'NoneType' object has no attribute group

Thank you in advance!!
 
Just stumbled upon this post and have been glued to it. Just have a few questions:

1) Where will the bot get likes from and can I can get it to get likes from accounts with certain number of followers?
2) If I want video views, can it also do that?

Thanks
 
Back
Top