ohld / igbot

🐙 Free scripts, bots and Python API wrapper. Get free followers with our auto like, auto follow and other scripts!
https://hikerapi.com/p/N2P6iqiM
Apache License 2.0
4.69k stars 1.47k forks source link

Collect_Stats :: Request return 404 error! #295

Closed Monoe closed 7 years ago

Monoe commented 7 years ago

Please follow the guide below


Before submitting an issue, make sure you have:

Purpose of your issue?


The following sections requests more details for particular types of issues, you can remove any section (the contents between the triple ---) not applicable to your issue.


For a bug report, you must include the Python version used, code that will reproduce the error, and the error log/traceback.

Paste the output of python -V here: Python 2.7.10

Code:

Using the "collect_stats.py" script that came in the clone/examples.

Error/Debug Log:

2017-07-27 15:37:10,395 - INFO - Login success as XXXX!
2017-07-27 15:37:10,851 - WARNING - Request return 404 error!
2017-07-27 15:37:12,012 - WARNING - Request return 404 error!
2017-07-27 15:37:13,177 - WARNING - Request return 404 error!
Traceback (most recent call last):
  File "collect_stats.py", line 31, in <module>
    bot.save_user_stats(args.user, path=args.path)
  File "/Library/Python/2.7/site-packages/instabot/bot/bot.py", line 384, in save_user_stats
    return save_user_stats(self, username, path=path)
  File "/Library/Python/2.7/site-packages/instabot/bot/bot_stats.py", line 45, in save_user_stats
    self.logger.info("Stats saved at %s." % data_to_save["date"])
UnboundLocalError: local variable 'data_to_save' referenced before assignment
2017-07-27 15:37:13,596 - INFO - Bot stopped. Worked: 0:04:40.355430
2017-07-27 15:37:13,596 - INFO - Total requests: 9

Describe your issue

Following the provided installation instructions for Mac OS X (today); doing the following... pip install -U instabot git clone https://github.com/instagrambot/instabot cd instabot/examples

I then tried to use the "collect_stats" script provided in the "examples" folder. I invoked the script in two different manners. The first time I provided all the command line args and launched (python collect_stats.py -u XXXX -p XXXX [account name to get stats on]). The second time I ran the script I let it create the "secret.txt" file providing the credentials it asks for, and that all goes well. Once the script has successfully logged in (INFO - Login success as XXXX!) it then continues the throw errors (Request return 404 error!) as indicated above.

I did look for any related issues with the "collect_stats.py" and saw that there was an issue raised two weeks ago -- "after update - collect_stats won't work #279". It looks like the issue was closed stating the the issue was closed with the latest update ("In update 1bba82b this problem was solved"). I looked at that diff to see if my installation matches the one being referenced, and it matches correctly with the update.

I'm not sure if this is relevant to the issue; but anytime I run this I do get a "instabot.log" and "XXXX.checkpoint" - but at no time do I ever get a "XXXX.tsv" file created.

The contents of my instabot.log file..

2017-07-27 15:32:33,241 Instabot Started 2017-07-27 15:32:35,096 Login success as XXXX! 2017-07-27 15:32:35,546 Request return 404 error! 2017-07-27 15:32:36,705 Request return 404 error! 2017-07-27 15:32:37,899 Request return 404 error! 2017-07-27 15:32:38,271 Bot stopped. Worked: 0:00:05.030614 2017-07-27 15:32:38,272 Total requests: 6 2017-07-27 15:36:44,800 Instabot Started 2017-07-27 15:37:10,395 Login success as XXXX! 2017-07-27 15:37:10,851 Request return 404 error! 2017-07-27 15:37:12,012 Request return 404 error! 2017-07-27 15:37:13,177 Request return 404 error! 2017-07-27 15:37:13,596 Bot stopped. Worked: 0:04:40.355430 2017-07-27 15:37:13,596 Total requests: 9

At this point I'm a little bit confused - i followed the instructions provided, which are very clear by the way (thank you!) but can not think what is going wrong. Any suggestions would be much appreciated.

Thank you..

bardascat commented 7 years ago

same thing happening

bardascat commented 7 years ago

I think the problem might be with the instagram v1 api - which returns 404

shubs commented 7 years ago

same ! since the last git pull

stanleyhafeld commented 7 years ago

Same problem "WARNING - Request return 404 error!" afther some time it will show up.

It said, going to like 83 media, and afther 14 likes it stopped because of the 404 error.

Monoe commented 7 years ago

Hello Everyone,

I wanted to update my open issue with "collect_stats.py". I did an update today to the instabot (about 10mins ago); and was pleasantly surprised to find that collect_stats is working again. Looking at the code in /examples - it says it was updated 2 months ago(?). I looked at the commit history in the example directory, but didn't see anything related to collect_stats. Honestly this is probably me not understanding how github works; and I apologize if I am wasting anyone's time.

But, ..good news! Collect_stats.py is working again as intended. When using the script like..

python collect_stats.py - it will ask you for the "secret" credentials if you have not set them up before (in that directory); then it will just run like normal with this output..

2017-09-01 13:08:36,335 - INFO - Login success as ig_username!
2017-09-01 13:08:37,570 - INFO - Stats saved at 2017-09-01 13:08:37.

The resulting "ig_username.tsv" file will also look normal again ..

tail -f ig_username.tsv 
date    followers   following   medias
2017-09-01 13:02:40 1221    2393    14
2017-09-01 13:08:37 1221    2393    14

I did find that if you try to invoke the script with command line arguments, you would not get the same expected results ...

python collect_stats.py -u ig_username -p XXXXXXXX ig_username
2017-09-01 13:07:58,362 - INFO - Instabot Started
2017-09-01 13:08:00,137 - INFO - Login success as ig_username!
2017-09-01 13:08:00,455 - WARNING - Request return 404 error!
2017-09-01 13:08:01,313 - WARNING - Request return 404 error!
2017-09-01 13:08:02,313 - WARNING - Request return 404 error!

So again, I'm not sure when something changed. I had been watching this page for issue updates, but have not seen any. In any case, somehow or someone got this fixed. And I just wanted to say thank you. Thank you for all your work and the community you provide.

Since I opened this issue and feel that it is now once again working as intended, I will now close this issue and consider it resolved. Again, thank you.