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

Problems with repost_best_photos_from_users #581

Closed Tankr3d closed 5 years ago

Tankr3d commented 6 years ago

Please follow the guide below


Before submitting an issue, make sure you have:

Purpose of your issue?


If I create the missed files ( posted_medias.txt and username_database.txt ) and drag it in examples I got this error (I use Python 3.6):

2018-06-08 12:38:30,593 - INFO - Logged-in successfully as 'machine4meme' using the cookie! Getting media info: 100%|██████████████████████████████████████████████████████████████| 72/72 [00:28<00:00, 2.12it/s] Reposting photos: 0%| | 0/1 [00:00<?, ?it/s] Traceback (most recent call last): File "C:\Users\Tom\Downloads\instabot-master\examples\repost_best_photos_from_users.py", line 90, in repost_best_photos(bot, users, args.amount) File "C:\Users\Tom\Downloads\instabot-master\examples\repost_best_photos_from_users.py", line 26, in repost_best_photos repost_photo(bot, media) File "C:\Users\Tom\Downloads\instabot-master\examples\repost_best_photos_from_users.py", line 65, in repost_photo with open(photo_path[:-3] + 'txt', 'r') as f: TypeError: 'bool' object is not subscriptable 2018-06-08 12:39:10,002 - INFO - Bot stopped. Worked: 23 days, 22:24:52.461533 2018-06-08 12:39:10,002 - INFO - Total requests: 875

basnijholt commented 6 years ago

So

    photo_path = bot.download_photo(new_media_id, save_description=True)

returns True.

This means the problem is here https://github.com/instagrambot/instabot/blob/master/instabot/api/api_photo.py#L21 or https://github.com/instagrambot/instabot/blob/master/instabot/api/api_photo.py#L16

Either api/api_photo.py has to change or the example script.

basnijholt commented 6 years ago

I've opened https://github.com/instagrambot/instabot/pull/582 which should fix this problem.

Tankr3d commented 6 years ago

@basnijholt Thanks for your help but i still can not get it to work here the error code if i changed api_photo and repost_best_photos_from_users as you wrote:

2018-06-25 15:44:19,712 - INFO - Logged-in successfully as 'machine4meme' using the cookie! Getting media info: 100%|███████████████████████████████████████████████████████████| 84/84 [00:37<00:00, 2.15it/s] Traceback (most recent call last): File "repost_best_photos_from_users.py", line 91, in repost_best_photos(bot, users, args.amount) File "repost_best_photos_from_users.py", line 24, in repost_best_photos medias = sort_best_medias(bot, medias, amount) File "repost_best_photos_from_users.py", line 31, in sort_best_medias best_medias = sorted(best_medias, key=lambda x: (x['like_count'], x['comment_count']), reverse=True) File "repost_best_photos_from_users.py", line 31, in best_medias = sorted(best_medias, key=lambda x: (x['like_count'], x['comment_count']), reverse=True) KeyError: 'comment_count' 2018-06-25 15:45:08,219 - INFO - Bot stopped. Worked: 0:14:16.622542 2018-06-25 15:45:08,220 - INFO - Total requests: 387

basnijholt commented 6 years ago

Do you get this error for the very first photo or after several?

Tankr3d commented 6 years ago

@basnijholt If this error occurs, the bot has not yet loaded a photo.

basnijholt commented 6 years ago

So it never ever works?

Tankr3d commented 6 years ago

@basnijholt No

basnijholt commented 6 years ago

@sudoguy should probably look at it then because he wrote this script.

Tankr3d commented 6 years ago

@basnijholt Hopefully he'll answer

basnijholt commented 6 years ago

This isn't fixed yet.

EightShift commented 6 years ago

Problem with , x ['comment_count'] I just deleted it and repost is work now. But... I want that the bot is keep work and do repost less "best" photo from another account. How it's possible?

EightShift commented 6 years ago

Or how to make the bot do repost the best photo from each account.

kintaro1981 commented 6 years ago

@EightShift you can launch it with a different username as argument, or create a loop for each account inside the script.

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

keyreel commented 5 years ago

Problem with , x ['comment_count'] I just deleted it and repost is work now. But... I want that the bot is keep work and do repost less "best" photo from another account. How it's possible?

Have same issue. Replace with:

try:
    best_medias = sorted(best_medias, key=lambda x: (x['like_count'], x['comment_count']), reverse=True)
except KeyError:
    best_medias = sorted(best_medias, key=lambda x: x['like_count'], reverse=True)