micahflee / semiphemeral

Automatically delete your old tweets, except for the ones you want to keep
MIT License
885 stars 85 forks source link

Is unliking working? #111

Closed jamesdalmau closed 1 year ago

jamesdalmau commented 2 years ago

I'm currently running the unlike command on my like.js. It's ticking over, continually printing lines that say "Fetched [date] [handle] [id]". But when I go to those tweets, My like is still recorded against them. Has anyone had this issue? Does it take a while for the unliking to propagate?

I should say that I've checked in with some of the users whose tweets ought to be "unliked" by this tool, and they're not receiving notifications about them, which makes me think they're not working.

JackSzwergold commented 2 years ago

The first step in this process is to fetch the liked Tweets. And then once all of the liked Tweets are fetched, the system kicks into the liking/unliking process. I am on macOS 13 (Ventura) and this is how it works.

Depending on how many “likes” you have, this fetching process can take a fairly long time. Just sit and wait and even let it run overnight and once all of the liked Tweets are fetched the core liking/unliking process process happens.

FWIW, this is what the actual process looks like when it kicks in; core details anonymized:

Reliked and unliked 2020-09-05 @someone, id=123456780123456780
Reliked and unliked 2020-09-04 @another_person, id=123456780123456780
Reliked and unliked 2020-09-04 @yet_another_person, id=123456780123456780
Reliked and unliked 2020-09-04 @oof_another, id=123456780123456780

And once you get to that stage, you don’t have to worry about keeping your PC on for days. I run it when I remember twice a day or so on my MacBook Air and it works fine. You can interupt it and restart it later on and it picks up where you left off.

jamesdalmau commented 2 years ago

Thanks very much for the explanation @JackSzwergold !

JackSzwergold commented 2 years ago

No problem, @jamesdalmau. And FWIW, the rate limit of 1,000 likes per day seems to not be consistent.

The last few days I have run it 4 or 5 times a day with a few hours between runs and each run handled 500 likes/unlikes; so I am effectively getting 1,500 to 2,500 likes/unlikes per day. Which is great!

Your mileage may vary, but try it on your side once you get to the like/unlike stage. When the rate limiting 24 hour message shows up, cancel the run and wait a few hours and run it again.

jamesdalmau commented 1 year ago

As it turns out, when that rate limiting message shows up, the program crashes:

Error liking tweet 1380410768202461184: Twitter error response: status code = 429 You can only like 1000 tweets per 24 hours and you have hit the limit See: https://developer.twitter.com/en/docs/basics/rate-limits Traceback (most recent call last): File "C:\Users\james\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\semiphemeral\twitter.py", line 642, in relike_unlike_tweets self.api.create_favorite(tweet.status_id) File "C:\Users\james\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\tweepy\binder.py", line 253, in _call return method.execute() File "C:\Users\james\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\tweepy\binder.py", line 234, in execute raise TweepError(error_msg, resp, api_code=api_error_code) tweepy.error.TweepError: Twitter error response: status code = 429

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2288.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 196, in _run_module_as_main return _run_code(code, main_globals, None, File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2288.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 86, in _run_code exec(code, run_globals) File "C:\Users\james\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\Scripts\semiphemeral.exe\__main__.py", line 7, in <module> File "C:\Users\james\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\click\core.py", line 1130, in __call__ return self.main(*args, **kwargs) File "C:\Users\james\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\click\core.py", line 1055, in main rv = self.invoke(ctx) File "C:\Users\james\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\click\core.py", line 1657, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "C:\Users\james\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\click\core.py", line 1404, in invoke return ctx.invoke(self.callback, **ctx.params) File "C:\Users\james\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\click\core.py", line 760, in invoke return __callback(*args, **kwargs) File "C:\Users\james\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\semiphemeral\__init__.py", line 91, in unlike t.unlike(filename) File "C:\Users\james\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\semiphemeral\twitter.py", line 618, in unlike self.relike_unlike_tweets(datetime_threshold, tweets) File "C:\Users\james\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\semiphemeral\twitter.py", line 674, in relike_unlike_tweets time.strftime("%b %d, %Y %l:%M%p %Z") ValueError: Invalid format string

I haven't been too bothered because it is actually working, and I just wait another 24 hours to kick it off, though.

Thanks again @JackSzwergold, I'm a total noob so appreciate the explanations.

JackSzwergold commented 1 year ago

@jamesdalmau Those errors are pretty much like what is discussed here in this other issue.

The solution that cleared it up for me is to install version of Tweepy lower than 4.x. So I did this and no more errors:

pip3 install tweepy==3.10.0

Try it and see if this gets rid of those errors and lets the process run cleanly.

alfcruz commented 1 year ago

Hello. This morning semiphemeral started the like/unlike cycle, I think. I found it printing many lines with the message below (different numbers):

"Error liking tweet 12345678901234567890: Read-only application cannot POST."

What can I do to make it work? Is it a problem with semiphemeral or with the configuration of the Twitter side of things?

Thank you...

alfcruz commented 1 year ago

Never mind, I found my mistake and corrected it on the Twitter app site. Very good software, this Semiphemeral! Thank you.

JackSzwergold commented 1 year ago

Hello. This morning semiphemeral started the like/unlike cycle, I think. I found it printing many lines with the message below (different numbers):

"Error liking tweet 12345678901234567890: Read-only application cannot POST."

What can I do to make it work? Is it a problem with semiphemeral or with the configuration of the Twitter side of things?

Thank you...

FWIW, the issue is you need Elevated access on your twitter Developer account so you can POST (aka: write) as well as GET (aka: READ) data to the Twitter API. Without Elevated access all you have is Essential access which is purely read only access.

alfcruz commented 1 year ago

Thank you, @JackSzwergold.