koenrh / delete-tweets

Delete tweets from your timeline.
ISC License
791 stars 107 forks source link

Unlike tweets #107

Open lucasresck opened 2 years ago

lucasresck commented 2 years ago

Hello there,

Thanks for the simple, useful, and effective tool to delete old tweets.

Besides deleting tweets, I was also searching for tools to delete old likes to tweets. I could not find one, so I have taken a look at your code (very neat, thank you!) and I have adapted it to remove old likes.

I have not implemented filtering and sparing and I am also not sure about the limit on the number of requests from the Twitter API, but I think it is a good start for the community.

During my tests, I noticed that many tweets were not able to be unliked because the hearts were gray instead of red at Twitter website, like if they were "ghost likes". So, in my implementation, when it is not possible to unlike a tweet, I ask the API to like it first before the unlike.

meghavarshini commented 2 years ago

Hello! This is a nifty enhancement. What is the command for unliking tweets in your implementation? I can’t seem to make it work.

I tried ./deletetweets/__main__.py --since 2021-01-01 --until 2021-01-31 --unlike path_to_like.js to test the code on the latest commit on your fork, but I get the following error:

line 109, in delete
    with io.open(likejs_path, mode="r", encoding="utf-8") as likejs_file:
TypeError: expected str, bytes or os.PathLike object, not NoneType

even though I can open like.js using the file path I provide.

Thanks in advance!

lucasresck commented 2 years ago

Hello! This is a nifty enhancement. What is the command for unliking tweets in your implementation? I can’t seem to make it work.

I tried ./deletetweets/__main__.py --since 2021-01-01 --until 2021-01-31 --unlike path_to_like.js to test the code on the latest commit on your fork, but I get the following error:

line 109, in delete
    with io.open(likejs_path, mode="r", encoding="utf-8") as likejs_file:
TypeError: expected str, bytes or os.PathLike object, not NoneType

even though I can open like.js using the file path I provide.

Thanks in advance!

Hi, @meghavarshini, thanks for reaching me!

The command would be like

python path_to_repo/deletetweets path_to_tweet.js --unlike --like_file path_to_like.js

Paths of both tweet.js and like.js must be provided for now, both are different flags. Date filtering, type filtering, and sparing are not implemented yet. So, for now, it's only possible to undo all likes at the same time (although many of them possibly wont work --- the case of ghost likes).

A nice improvement would be merging both path flags and asserting filters and spare are not received to avoid mistakes until they are implemented (if they will). I'd suggest you to take a look at the code, it's kinda simple, maybe you can have these things working if you need to.

Thanks!

lucasresck commented 2 years ago

Hi, @meghavarshini,

It should be easy now:

python path_to_repo/deletetweets path_to_like.js --unlike --dry-run

The --dry-run flag is for testing before really applying the changes. You can remove it after asserting it's everything alright.

meghavarshini commented 2 years ago

Hi, @meghavarshini,

It should be easy now:

python path_to_repo/deletetweets path_to_like.js --unlike --dry-run

The --dry-run flag is for testing before really applying the changes. You can remove it after asserting it's everything alright.

Thanks @lucasresck ! I got it to work, and the behaviour was exactly as described. A good learning opportunity for me, of course! I will take a look at your code and play around, thanks for the new flag!

jimen0 commented 2 years ago

Just wanted to leave my πŸ‘πŸ» on this PR. I was looking for something prebuilt to erase most of the contents in my profile and this tool + this specific PR did the job. Thank you a lot!

lucasresck commented 2 years ago

Just wanted to leave my πŸ‘πŸ» on this PR. I was looking for something prebuilt to erase most of the contents in my profile and this tool + this specific PR did the job. Thank you a lot!

Happy to help! 😁

Did the feature of unliking tweets work nice for you? Have you experienced the "ghost likes" I mentioned?

jimen0 commented 2 years ago

Hi @lucasresck - Yes, I experienced it too! Indeed I reached out to the Twitter team asking for their support since I was deleting my data by my own. However, I'm not being lucky at all as the support from their side is very much limited. You can see the thread here.

I've re-requested my twitter archive again and will do a second pass in case I can remove the pending ghost likes this way.

jimen0 commented 2 years ago

Hi @lucasresck - I re-ran the unlike process and can confirm there are at least 228 likes I cannot undo. I guess we will have to wait until Twitter engineering fixes this 😭 .

lucasresck commented 2 years ago

Hi, @jimen0, thanks for sharing this detailed analysis of this tweet unliking problem! Happy to be part of this investigation.

I remember to face this problem last year, that's why I put on the code a try except to like and unlike the tweet when it's not possible to unlike it at first. I am just not sure now (too much time πŸ‘€), but I believe this solution wasn't completely effective.

Sad to hear that your problem couldn't be solved yet. Just to clarify, in the thread at the Twitter Community you marked the problem as solved, but it's still not solved even with this pull request, right?

I faced a few not intuitive problems like this when experimenting with this code. For instance, even when all my tweets were erased (my posts, not likes), the tweet counting on my Twitter profile was never zero, as if there were also a few "ghost tweets" haha

jimen0 commented 2 years ago

I got tired of waiting for them to acknowledge the problem, to be honest. Feel free to open a new thread and I'll share my case too there.

Ckk3 commented 1 year ago

Amazing job! Thank you so much, i hope this go to the main app soon!

lucasresck commented 1 year ago

Amazing job! Thank you so much, i hope this go to the main app soon!

Thanks for your kind words! Happy to help :)