Closed disayner closed 5 years ago
You should break that script up....
Also don't use arguments until you know it's working. Or at least I wouldn't. I would break that script up to find out what your error is.
I would change this:
except ValueError:
print(u"\n Not valid choice. Try again")
To:
except Exception as e:
print(e)
raise
I would also just test this piece of code.
try:
bot = Bot()
username = ''
password = ''
proxy = ''
bot.login(username=username, password=password, proxy=proxy)
bot.api.search_location('Moscow')
result = like_location_feed(bot, bot.api.last_json["items"][1], amount=int(1))
print(result)
except Exception as e:
print(e)
raise
If you're still getting an error, then you know its not pebcak and something wrong with the repo.
You should break that script up....
Also don't use arguments until you know it's working. Or at least I wouldn't. I would break that script up to find out what your error is.
I would change this:
except ValueError: print(u"\n Not valid choice. Try again")
To:
except Exception as e: print(e) raise
I would also just test this piece of code.
try: bot = Bot() username = '' password = '' proxy = '' bot.login(username=username, password=password, proxy=proxy) bot.api.search_location('Moscow') result = like_location_feed(bot, bot.api.last_json["items"][1], amount=int(1)) print(result) except Exception as e: print(e) raise
If you're still getting an error, then you know its not pebcak and something wrong with the repo.
Thanks for the answer. I created a test script:
from instabot import Bot
try:
bot = Bot()
username = 'user'
password = 'pass'
bot.login(username=username, password=password)
bot.api.search_location('Moscow')
result = bot.like_location_feed(bot, bot.api.last_json["items"][1], amount=int(1))
print(result)
except Exception as e:
print(e)
raise
and got an error:
2019-07-18 11:00:03,720 - INFO - Instabot Started
2019-07-18 11:00:06,121 - INFO - Logged-in successfully as 'user'!
Traceback (most recent call last):
File "J:/scripts/test.py", line 12, in <module>
result = bot.like_location_feed(bot, bot.api.last_json["items"][1], amount=int(1))
IndexError: list index out of range
list index out of range
2019-07-18 11:00:07,666 - INFO - Bot stopped. Worked: 1 day, 19:31:26.032402
2019-07-18 11:00:07,667 - INFO - Total requests: 334
Then I deleted instabot using PIP
pip uninstall instabot
Checked that it was deleted by re-entering the command for deletion.
And removed the python and installed the latest version.
Downloaded the latest version instabot:
https://github.com/instagrambot/instabot/archive/master.zip
unpacked, moved to the instabot-master folder and executed the command
setup.py install
after installation, restarted the script. Nothing has changed, the same mistake.
Then I deleted instabot using PIP
pip uninstall instabot
And install instabot using PIP
pip install -U instabot
after installation, restarted the script. Nothing has changed, the same mistake.
Tell me please, what other options might there be?
Are you familiar with what the error response “list index out of range” means? You could also google that and get some good info...
It means that when you try “list[1]”, that there are not “2” items in the list... 0,1 = 2 items. So can you infer what your next debug step is?
Thank you for taking part in my problem.
It means that when you try “list[1]”, that there are not “2” items in the list... 0,1 = 2 items. So can you infer what your next debug step is?
I understand what that means. I do not understand why you asked this.
In the first message you wrote:
If you're still getting an error, then you know its not pebcak and something wrong with the repo.
I still getting an error. Therefore, I did not write other steps that I did.
I tried to change the index. bot.api.last_json["items"][0] #0 bot.api.last_json["items"] #no second index it changed nothing
Then I tried immediately after searching for a location. See what returns [item]: bot.api.search_location('Moscow') print (bot.api.last_json["items"]) # Out - [] - There is nothing print (bot.api.last_json) # Out - {'items': [], 'has_more': True, 'rank_token': '6421777250_bcd846a6-f215-412c-bd5b-e98925032438', 'status': 'ok'}
Apparently the method bot.api.search_location ('Moscow') does not return location.
That's what's interesting. There is no Moscow in this list. https://www.instagram.com/explore/locations/RU/russia/
But she is. https://www.instagram.com/explore/locations/359545221/moscow/
If we just beat the city and change the example as follows. That works like users posting story. bot.like_location_feed("Omsk", 10)
Did you try
bot.api.search_location('Moscow')
print (bot.api.last_json)
What is that result?
What you need to do is fork the repo and go to work on debugging.....
Enter print statements everywhere until you find the moment where the error exists. Maybe the endpoint changed, or it returns "locations" not "items". idk
Go into the api.py and add print statements. Make sure you're getting a 200 response. Check to see if maybe a lower case is required. There is plenty more you can do to debug this issue.
If you continue to post your stacktrace and error logs I'll ty to help you.
Did you try
bot.api.search_location('Moscow') print (bot.api.last_json)
What is that result?
bot.api.search_location('Moscow') print (bot.api.last_json) # Out - {'items': [], 'has_more': True, 'rank_token': '6421777250_bcd846a6-f215-412c-bd5b-e98925032438', 'status': 'ok'}
What you need to do is fork the repo and go to work on debugging.....
Enter print statements everywhere until you find the moment where the error exists. Maybe the endpoint changed, or it returns "locations" not "items". idk
Go into the api.py and add print statements. Make sure you're getting a 200 response. Check to see if maybe a lower case is required. There is plenty more you can do to debug this issue.
If you continue to post your stacktrace and error logs I'll ty to help you.
Thank. I'll try
Purpose of your issue?
Code:
Error/Debug Log:
Describe your issue
Hello to all. Tell me please somebody. How to use this script. What am I doing wrong? Whatever the city, the result is the same. Nothing likes.