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

Filtering media not working as it should #1254

Open
5 of 7 tasks
TerrorFactor opened this issue Jan 22, 2020 · 3 comments
Open
5 of 7 tasks

Filtering media not working as it should #1254

TerrorFactor opened this issue Jan 22, 2020 · 3 comments

Comments

@TerrorFactor
Copy link

Please follow the guide below

  • Issues submitted without this template format will be ignored.
  • You will be asked some questions and requested to provide some information, please read them carefully and answer completely.
  • Put an x into all the boxes [ ] relevant to your issue (like so [x]).
  • Use the Preview tab to see how your issue will actually look like.

Before submitting an issue, make sure you have:

  • Updated to the latest version
  • Read the README and docs
  • Searched the bugtracker for similar issues including closed ones

Purpose of your issue?

  • Bug report (encountered problems/errors)
  • Feature request (request for a new functionality)
  • Question
  • Other

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

Code:

# Example code that will produce the error reported
from instabot import Bot

bot = Bot()
bot.login(username="user", password="pass")
medias = bot.get_hashtag_medias("drifted")

Error/Debug Log:

2020-01-22 23:06:04,738 - DEBUG - GET to endpoint: feed/tag/drifted/?max_id=&rank_token=28438133771_e63fb8db-0d3d-4882-8052-fd2c482ba12d&ranked_content=true& returned response: <Response [200]>
2020-01-22 23:06:04,779 - INFO - Received 84 medias.
2020-01-22 23:06:04,780 - INFO - After filtration 0 medias left.

I followed the installation guide, and used pip to install the bot. Then used git to download the examples, as shown in the installation guide for Linux.
I am using everything default, nothing changed.

After going through the code, I tried to comment the filter_medias function in bot_filter.py, like this:

def filter_medias(self, media_items, filtration=True, quiet=False, is_comment=False):
    # if filtration:
        # if not quiet:
            # self.logger.info("Received {} medias.".format(len(media_items)))
        # if not is_comment:
            # media_items = _filter_medias_not_liked(media_items)
            # if self.max_likes_to_like:
                # media_items = _filter_medias_nlikes(
                    # media_items, self.max_likes_to_like, self.min_likes_to_like
                # )
        # else:
            # media_items = _filter_medias_not_commented(self, media_items)
        # if not quiet:
            # msg = "After filtration {} medias left."
            # self.logger.info(msg.format(len(media_items)))
    return _get_media_ids(media_items)

Weirdly enough, this doesn't solve it, and I get:

2020-01-22 23:06:04,779 - INFO - Received 84 medias.
2020-01-22 23:06:04,780 - INFO - After filtration 3 medias left.

Using

medias = bot.get_hashtag_medias("drifted",filtration=False)

does seem to work, but you obviously don't have any control at that point anymore.

Initially I tried using the example script to download by hashtag (same error), but tried manually to simplify the problem as much as possible.

@duplicate-issues
Copy link

Hey @TerrorFactor,

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

@bruvv bruvv added the bug label Jan 23, 2020
@bruvv
Copy link
Collaborator

bruvv commented Jan 23, 2020

Thanks for the issue! Indeed looks like a bug, when I have more time I can debug the other issues first.

@stale
Copy link

stale bot commented Mar 23, 2020

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.

@stale stale bot added the stale label Mar 23, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants