Skip to content
This repository has been archived by the owner on Feb 25, 2024. It is now read-only.

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

Open
4 tasks done
MrMdR opened this issue Mar 9, 2020 · 9 comments
Open
4 tasks done
Labels

Comments

@MrMdR
Copy link

MrMdR commented Mar 9, 2020

Before submitting an issue, make sure you have:

  • Updated to the lastest version
  • Read the README
  • Searched the bugtracker for similar issues including closed ones
  • 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:
#1254
#1240
#1283
#1219
#701
#297
#723
#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 MrMdR added the question label Mar 9, 2020
@duplicate-issues
Copy link

Hey @MrMdR,

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

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

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

Cheers,
Your Friendly Neighborhood ProBot

@MrMdR MrMdR changed the title [BUG/QUESTION] Like/comment timeline, the filtration issue. [BUG/QUESTION] Like/comment timeline, the filtration issue. How and why does it filter? Mar 9, 2020
@Doome161
Copy link

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

@sobrinojulian
Copy link

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.

@BlickyMouse
Copy link

BlickyMouse commented Mar 22, 2020

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?

@sobrinojulian
Copy link

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

@MrMdR
Copy link
Author

MrMdR commented Apr 6, 2020

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
Copy link
Author

MrMdR commented Apr 6, 2020

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!

@chrishsr
Copy link

chrishsr commented Apr 12, 2020

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
Copy link

--------------------------------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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

5 participants