edoardottt / twitterbot2

Like and retweet your tweets, or search tweets by topic. It stores and serves data with a Flask webapp. 🐦 Live demo running on twitter.com/ai_testing
https://edoardoottavianelli.it
GNU General Public License v3.0
57 stars 8 forks source link

Retweeting my own retweets #42

Closed Boroom closed 2 years ago

Boroom commented 2 years ago

My twitter account is empty. I started the bot using a keyword. So it liked and reweeted some tweets. Then after a few moments, it started to tell me that it was liking and retweeting my own tweets...! I don't know if that's a "chosen feature" but it seems to be an unwanted one ! I hope I was clear.

edoardottt commented 2 years ago

Thanks for your submission Boroom, I'm gonna explain breiefly how this project works and so we can understand if this is the intended or unintended behavior.

Let's take a scenario: I have two users on twitter, edoardottt and edobot. The one I have access to API is edobot, this means I will set:

If now I start twitterbot 2 with python twitterbot2.py -k happy this will:

  1. Search for tweets related to the term "happy".
  2. Search for tweets in edoardottt 's timeline.

If you don't want to like and retweet edoardottt's tweets you have to execute python twitterbot2.py -k happy -nu. -nu means no user and will search (two times instead of one, so double tweets) only for terms happy.

Now, when you say "liking and retweeting my own tweets", you means your bot is liking and retweeting edobot's tweets or your personal user's tweets?

Thanks :)

Boroom commented 2 years ago

Maybe I misunderstood something but I'm trying to explain better what I've seen !

In your case, you're telling me that you have 2 accounts, one is your "personal" and the other the "bot" one (where you have the api keys). In my case, I only have one account (and maybe this is the issue). My twitter account was empty (no tweets, no friends, no like, nothing 🤣).

I ran python twitterbot2.py -k #MSB for example and it appears that there were only a few tweets where there was this #. So first, it started correctly to like and retweet the tweets that were found and then, after a few seconds (and because there aren't other tweets anymore) started to tell me in the console that the bot was retweeting and favs the tweets from... my account ! And because my account was empty at the beginning, this means that it was trying to retweet the tweets I already retweeted ! I hope this was more clear. For each tweets like this, I got some errors on the logs.

Here are some of the logs like this you can see what I mean !

BasketFrElite: ERROR:2021-11-15 10:04:52,954 | HTTP Error 403: Forbidden on 1.1/favorites/create <---- BasketFrElite: INFO:2021-11-15 10:04:52,954 | Sleeping for ten seconds. BasketFrElite: INFO:2021-11-15 10:05:02,965 | Today tweets count: 0 BasketFrElite: INFO:2021-11-15 10:05:02,965 | Today likes count: 0 BasketFrElite: INFO:2021-11-15 10:05:02,965 | Today retweets count: 0 BasketFrElite: INFO:2021-11-15 10:05:02,965 | Followers count: 0 BasketFrElite: INFO:2021-11-15 10:05:03,913 | Liked a tweet by BasketEliteFr BasketFrElite: INFO:2021-11-15 10:05:04,218 | Database updated. BasketFrElite: ERROR:2021-11-15 10:05:04,218 | HTTP Error 403: Forbidden on 1.1/favorites/create <---- BasketFrElite: INFO:2021-11-15 10:05:04,218 | Sleeping for ten seconds. BasketFrElite: INFO:2021-11-15 10:05:14,232 | Today tweets count: 0 BasketFrElite: INFO:2021-11-15 10:05:14,232 | Today likes count: 0 BasketFrElite: INFO:2021-11-15 10:05:14,232 | Today retweets count: 0 BasketFrElite: INFO:2021-11-15 10:05:14,232 | Followers count: 0 BasketFrElite: INFO:2021-11-15 10:05:16,096 | Liked a tweet by BasketEliteFr BasketFrElite: INFO:2021-11-15 10:05:17,425 | Database updated. BasketFrElite: ERROR:2021-11-15 10:05:17,425 | HTTP Error 403: Forbidden on 1.1/favorites/create <----

Boroom commented 2 years ago

And I don't think that it is a behavior that was wanted ! But the error is well managed so it's not a real issue 😃 You could just see if the tweets is from myself, then don't do anything os something like that!

edoardottt commented 2 years ago

Okay, got it. You should also provide the flag '-nu'. It means no user and with this option enabled the bot will not like and retweet your user tweets. See if this works :)

Boroom commented 2 years ago

In fact I thought using -nu was only used to avoid to retweet tweets. The utility of the -nu was not clear for me in fact !

edoardottt commented 2 years ago

Perfect, I think I can close the issue. :)