igbot icon indicating copy to clipboard operation
igbot copied to clipboard

[BUG/QUESTION] Like/comment timeline, the filtration issue. How and why does it filter?

Open MrMdR opened this issue 4 years ago β€’ 9 comments

Before submitting an issue, make sure you have:

  • [x] Updated to the lastest version
  • [x] Read the README
  • [x] Searched the bugtracker for similar issues including closed ones
  • [x] Reviewed the sample code in tests and examples

Describe your Question/Issue:

Hello,

I have been trying to use instabot for 2 years now but it seems I can not solve/wrap my head around one thing. After filtration 0 medias left.

Weather I use bot.comment_medias() or bot.like_timeline() or bot.like_medias(bot.get_timeline_medias()) or even timeline_medias = bot.get_timeline_medias() for media in tqdm(timeline_medias, desc="timeline"): bot.like_user(bot.get_media_owner(media))

They all give 0 results. But not always. Something's it likes 1, or comments 1. Very rarely tho.

First I thought bot.like_timeline() was corrupted, therefore I gathered 2 other methods of liking timeline feed posts. They are probably all the same because the results are also always the same: 0.
For a long time, I thought that the filtration was something like β€œalready viewed”. That Instagram/bot keep track of what post I’ve already seen on my timeline and filter those out. So I did not open my Instagram for 3 days while my friends were posting photos. I ran the attached script and… After filtration 0 medias left..

Some additional information:

  • The media to like are of my friends, I follow them and they follow me.
  • They post regularly. Every day there are a few new posts.
  • The medias have already a few likes.
  • I’m running windows 10 and python 3.7
  • As said on the gitup landing page there are a lot of filters built-in instabot. I’ve tried to play with these without success. https://github.com/instagrambot/instabot/blob/master/instabot/bot/bot.py#L134

My installation & usage process is as follows:

  1. I did a full install of python
  2. I opened CMD.exe and enter pip install -U instabot (as recently as yesterday)
  3. Download the master ZIP file (as recently as yesterday) and unzip it in C:\Users\mmark\Downloads\
  4. I enter in the command prompt cd downloads\instabot-master\examples
  5. I enter the command like_timeline_feed.py or the script below.

I’ve seen more people having raised this issue. These are similar issues I came across but could not solve my problem: https://github.com/instagrambot/instabot/issues/1254 https://github.com/instagrambot/instabot/issues/1240 https://github.com/instagrambot/instabot/issues/1283 https://github.com/instagrambot/instabot/issues/1219 https://github.com/instagrambot/instabot/issues/701 https://github.com/instagrambot/instabot/issues/297 https://github.com/instagrambot/instabot/issues/723 https://github.com/instagrambot/instabot/issues/724

It seems there is a lot of confusion about this issue. People, myself included, do not understand what the nature is of this issue people are having. I was hoping that by giving one elaborate post someone could point me in the right direction / see what I did wrong.

  • Maybe someone could explain to me why this is happening.
  • Perhaps the β€˜error’ messaging could be less arbitrary?
  • Is there a way to turn filtration 100% off and just take the last 10 un-liked media from my timeline? That would be the most logical I would say.

Thank you for your help!


Code you are using:

import instabot
import os
import sys

from tqdm import tqdm

sys.path.append(os.path.join(sys.path[0], "../"))
from instabot import Bot  # noqa: E402

bot = Bot(filter_users=False, filter_previously_followed=False, comments_file="comments.txt", max_follows_per_day=100, follow_delay=30)

if not os.path.exists("comments.txt"):
    print("Can't find '%s' file." % ". comments.txt")
    exit()

bot.login(username="USER", password="PSWRD")

while True:
    bot.logger.info("--Comment om media--")
    bot.comment_medias(bot.get_timeline_medias())
    bot.logger.info("--option 1--")
    timeline_medias = bot.get_timeline_medias()
    for media in tqdm(timeline_medias, desc="timeline"):
        bot.like_user(bot.get_media_owner(media))
    bot.logger.info("--option 2--")
    bot.like_medias(bot.get_timeline_medias())
    bot.logger.info("- option 3--")
    bot.like_timeline()

Error/Debug Log:

2020-03-09 12:51:55,473 - INFO - Received 6 medias.
2020-03-09 12:51:55,473 - INFO - After filtration 0 medias left.
2020-03-09 12:51:55,473 - INFO - Nothing to like.

MrMdR avatar Mar 09 '20 11:03 MrMdR

Hey @MrMdR,

We did a quick check and this issue looks very darn similar to

  • #1353 - [QUESTION] how are the parameters of reply_to_media_comments.py defined?
  • #1343 - [QUESTION] Can't login, Instagram keep asking me if this was me and every time I click yes still won't login
  • #1341 - Pics directory in autopost deletes files

This could be a coincidence, but if any of these issues solves your problem then I did a good job :smile:

If not, the maintainers will get to this issue shortly.

Cheers, Your Friendly Neighborhood ProBot

duplicate-issues[bot] avatar Mar 09 '20 11:03 duplicate-issues[bot]

i have only recently started working with the bot, but i would guess that due to the standard filters set in the bot's construct your media will be filtered

this code can be found under \instabot\instabot\bot\bot.py

class Bot(object):
    def __init__(
        self,
        base_path=current_path + "/config/",
        whitelist_file="whitelist.txt",
        blacklist_file="blacklist.txt",
        comments_file="comments.txt",
        followed_file="followed.txt",
        unfollowed_file="unfollowed.txt",
        skipped_file="skipped.txt",
        friends_file="friends.txt",
        proxy=None,
        max_likes_per_day=random.randint(50, 100),
        max_unlikes_per_day=random.randint(50, 100),
        max_follows_per_day=random.randint(50, 100),
        max_unfollows_per_day=random.randint(50, 100),
        max_comments_per_day=random.randint(50, 100),
        max_blocks_per_day=random.randint(50, 100),
        max_unblocks_per_day=random.randint(50, 100),
        max_likes_to_like=random.randint(50, 100),
        min_likes_to_like=random.randint(50, 100),
        max_messages_per_day=random.randint(50, 100),
        filter_users=False,
        filter_private_users=False,
        filter_users_without_profile_photo=False,
        filter_previously_followed=False,
        filter_business_accounts=False,
        filter_verified_accounts=False,
        max_followers_to_follow=5000,
        min_followers_to_follow=10,
        max_following_to_follow=2000,
        min_following_to_follow=10,
        max_followers_to_following_ratio=15,
        max_following_to_followers_ratio=15,
        min_media_count_to_follow=3,
        max_following_to_block=2000,
        like_delay=random.randint(300, 600),
        unlike_delay=random.randint(300, 600),
        follow_delay=random.randint(300, 600),
        unfollow_delay=random.randint(300, 600),
        comment_delay=random.randint(300, 600),
        block_delay=random.randint(300, 600),
        unblock_delay=random.randint(300, 600),
        message_delay=random.randint(300, 600),
        stop_words=("shop", "store", "free"),
        blacklist_hashtags=["#shop", "#store", "#free"],
        blocked_actions_protection=True,
        blocked_actions_sleep=True,
        blocked_actions_sleep_delay=random.randint(600, 1200),
        verbosity=True

Doome161 avatar Mar 12 '20 12:03 Doome161

I found a workaround for this issue. On instabot/instabot/bot/bot_get.py at line 75. def get_timeline_medias(self, filtration=True). set filtration=False. I tried it with examples/infinity_feedliker.py.

sobrinojulian avatar Mar 21 '20 15:03 sobrinojulian

I found a workaround for this issue. On instabot/instabot/bot/bot_get.py at line 75. def get_timeline_medias(self, filtration=True). set filtration=False. I tried it with examples/infinity_feedliker.py.

I attempted that workaround on examples/comment/comment_your_feed and it is not currently working.

Setting filtration=False on line 75 continually throws:

Received x medias. After filtration 0 medias left. Going to comment 0 medias.

Did this fix the issue for you because I have not had any success and can't seem to grasp the root cause of this bug?

BlickyMouse avatar Mar 22 '20 06:03 BlickyMouse

Hi. I'm sorry my usecase was just liking. So I didnt even read about comment in the issue title. It works with infinity_feedliker.py.

Checkout comment_medias method at line 91 in /instabot/bot/bot_comment.py. Try removing:

if not self.check_media(media):
    continue

check_media seems to return always false (making comment to be skiped on that media). Except in one case.

 if self.filter_medias(medias, quiet=True):
    return check_user(self, self.get_media_owner(media_id))

and

filter_medias(self, media_items, filtration=True, quiet=False, is_comment=False)

has filtration true by default. So again filtration issues I guess.

(I didnt try it. And won't try it because I dont feel like spaming random 'heys' since I use my personal Instagram account πŸ˜‚). Hope it helps

sobrinojulian avatar Mar 22 '20 20:03 sobrinojulian

i have only recently started working with the bot, but i would guess that due to the standard filters set in the bot's construct your media will be filtered

this code can be found under \instabot\instabot\bot\bot.py

class Bot(object):
    def __init__(
        self,
        base_path=current_path + "/config/",
        whitelist_file="whitelist.txt",
  ....

Hi, Thanks for your reply. Yes, I know about those filters. Setting them to False does not seem to make the difference. What is your experience so far?

MrMdR avatar Apr 06 '20 20:04 MrMdR

I found a workaround for this issue. On instabot/instabot/bot/bot_get.py at line 75. def get_timeline_medias(self, filtration=True). set filtration=False. I tried it with examples/infinity_feedliker.py.

Hi, Thanks for you suggestion! I tried your suggestion. However, I still get the following in the console: 2020-04-06 22:23:49,115 - INFO - Liking timeline feed: 2020-04-06 22:23:50,222 - INFO - Received 8 medias. 2020-04-06 22:23:50,222 - INFO - After filtration 0 medias left. 2020-04-06 22:23:50,228 - INFO - Nothing to like. 2020-04-06 22:23:50,233 - INFO - Total requests: 32

I used like_timeline_feed.py. As you can see there are 8 media, but for some mysterious reason, non are liked.

Does anyone know what the reason is for this? Thanks in advance!

MrMdR avatar Apr 06 '20 20:04 MrMdR

if had a look at the code because i had the same problem, i had success by changing line 75 in C:\Users\username\AppData\Local\Programs\Python\Python37\Lib\site-packages\instabot-0.117.0-py3.7.egg\instabot\bot from def get_timeline_medias(self, filtration=True): to def get_timeline_medias(self, filtration=False):

this changed my console output to

2020-04-12 20:17:54,898 - INFO - Not yet logged in starting: PRE-LOGIN FLOW! 2020-04-12 20:17:57,492 - INFO - Logged-in successfully as fucktdup! 2020-04-12 20:17:57,492 - INFO - LOGIN FLOW! Just logged-in: True 2020-04-12 20:18:10,681 - INFO - Going to comment 8 medias. 0%| | 0/8 [00:00<?, ?it/s] Traceback (most recent call last): File "C:\Users\Chris\Desktop\Instagram\Instabot-master (not working)\instabot-master\examples\comment\comment_your_feed.py", line 34, in bot.comment_medias(bot.get_timeline_medias()) File "C:\Users\Chris\AppData\Local\Programs\Python\Python37\lib\site-packages\instabot-0.117.0-py3.7.egg\instabot\bot\bot.py", line 923, in comment_medias return comment_medias(self, medias) File "C:\Users\Chris\AppData\Local\Programs\Python\Python37\lib\site-packages\instabot-0.117.0-py3.7.egg\instabot\bot\bot_comment.py", line 98, in comment_medias text = self.get_comment() File "C:\Users\Chris\AppData\Local\Programs\Python\Python37\lib\site-packages\instabot-0.117.0-py3.7.egg\instabot\bot\bot.py", line 633, in get_comment return get_comment(self) File "C:\Users\Chris\AppData\Local\Programs\Python\Python37\lib\site-packages\instabot-0.117.0-py3.7.egg\instabot\bot\bot_get.py", line 316, in get_comment return self.comments_file.random().strip() File "C:\Users\Chris\AppData\Local\Programs\Python\Python37\lib\site-packages\instabot-0.117.0-py3.7.egg\instabot\utils.py", line 53, in random return random.choice(self.list) File "C:\Users\Chris\AppData\Local\Programs\Python\Python37\lib\site-packages\instabot-0.117.0-py3.7.egg\instabot\utils.py", line 16, in list lines = [x.strip("\n") for x in f.readlines()] File "C:\Users\Chris\AppData\Local\Programs\Python\Python37\lib\encodings\cp1252.py", line 23, in decode return codecs.charmap_decode(input,self.errors,decoding_table)[0] UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 4: character maps to 2020-04-12 20:18:11,384 - INFO - Total requests: 39

C:\Users\Chris\Desktop\Instagram\Instabot-master (not working)\instabot-master\examples\comment>

as you can see it wants to comment 8 posts now, but i get some other errors rn. I will add a solution to those asap when i find one.

ps and yes, i am to dumb to format my output in rhe right way:D

chrishsr avatar Apr 12 '20 18:04 chrishsr

--------------------------------UPDATE-----------------------------------

for everyone who uses the standart font from notrfpad unlike me, my solution works without any problems, i checked it rn.

for everyone else, who uses some fancy font shit like me example: 𝕀'π•ž 𝕒 π•€π•žπ•’π•π• π•žπ•–π•žπ•– π•‘π•’π•˜π•– π•’π•Ÿπ•• π•šπ•₯ 𝕨𝕠𝕦𝕝𝕕 𝕓𝕖 π•Ÿπ•šπ•”π•– π•šπ•— π•ͺ𝕠𝕦 π•”π•™π•–π•”π•œ π•žπ•– 𝕠𝕦π•₯ :) this wont work, because the bot can not reat this text format. I am currently working on finding out where exactly t have to put in and encoder and get it to work. I'll update you guys.

chrishsr avatar Apr 12 '20 18:04 chrishsr