Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop retweeting blocked acccounts. #1365

Closed
humblelad opened this issue May 15, 2020 · 4 comments
Closed

Stop retweeting blocked acccounts. #1365

humblelad opened this issue May 15, 2020 · 4 comments
Labels
Question This is a question

Comments

@humblelad
Copy link

Is there a way to stop retweeting blocked accounts(which was done manually). In the sense, it should not retweet if the user id is in the block list. Any help appreciated. .: :)

@humblelad
Copy link
Author

@MichaelCurrin Can you help with the query?

@MichaelCurrin
Copy link

@humblelad Is your blocked list stored in your application or in Twitter?

For the latter try

blocked_users = api.blocks()

Then you can get user.id or user.screen_name on the result.

You might want to get the blocked list at application start (to save regularly checking) and then reuse it for your retweeting.

http://docs.tweepy.org/en/latest/api.html#API.blocks

@humblelad
Copy link
Author

@MichaelCurrin https://github.com/humblelad/HashTagger-Twitter-Bot/blob/master/hashtagger.py Here is the sample code. I want to stop retweeting accounts which I blocked manually via twitter to stop spams.

@Harmon758
Copy link
Member

As explained, you can use API.blocks or API.blocks_ids and check against the IDs of the users you have blocked, using the user attribute of the Status/Tweet object and the id attribute of the User object.

@Harmon758 Harmon758 added the Question This is a question label Jul 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Question This is a question
Projects
None yet
Development

No branches or pull requests

3 participants