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

Delete all your tweets using rtweet | Julia Silge #78

Open
utterances-bot opened this issue Nov 15, 2022 · 9 comments
Open

Delete all your tweets using rtweet | Julia Silge #78

utterances-bot opened this issue Nov 15, 2022 · 9 comments

Comments

@utterances-bot
Copy link

Delete all your tweets using rtweet | Julia Silge

A data science blog

https://juliasilge.com/blog/delete-tweets/

Copy link

Wonderful.
Wondering how to unlike all liked tweets

@juliasilge
Copy link
Owner

juliasilge commented Nov 15, 2022

@myaseen208 You'll want to get a list of all your favorites/likes (here is some advice on how to do this), and then iterate through using post_favorite() with destroy = TRUE.

Copy link

mcanouil commented Nov 21, 2022

Thanks for this, I cleaned up a bit my timeline with a slightly different script.
https://gist.github.com/mcanouil/09508af388799fde9518b30c59c2445d

library(jsonlite)
library(data.table)
library(rtweet)

auth_setup_default()

tweets <- as.data.table(
  fromJSON(paste(sub("window.YTD.like.part0 = ", "", readLines("data/tweets.js")), collapse = ""))[["tweet"]]
)[
  j = created_at := as.POSIXct(created_at, format = "%a %b %d %H:%M:%S %z %Y")
][
  created_at <= as.POSIXct(Sys.Date() - 30)
][
  order(created_at)
][
  j = list(list(try(post_destroy(id)))),
  by = id
]

likes <- as.data.table(
  fromJSON(paste(sub("window.YTD.like.part0 = ", "", readLines("data/like.js")), collapse = ""))[["like"]]
)[
  j = list(list(try(post_favorite(status_id = tweetId, destroy = TRUE)))),
  by = tweetId
]

Copy link

@mcanouil, thanks for very concise R code. However, the last likes part throws the following error:
Error : Twitter API failed [404]
Check error message at https://developer.twitter.com/en/support/twitter-api/error-troubleshooting
Any thoughts, please.

@mcanouil
Copy link

mcanouil commented Dec 1, 2022

404 is "not found" which can occur when the tweet was already deleted.
This is why I added a "try" in it, in case you run it several times without checking if the tweets or anything still exist.
My code is concise but lazy since I do not check inputs, etc.

Copy link

Thank you for sharing this info! Do you have a recommendation for other apps or social networks that data science and rstats folks are using?

@juliasilge
Copy link
Owner

@michaellomuscio I don't know what will happen in the long run or where folks will land eventually. I've actually been seeing more nice discussion on LinkedIn 😱 lately, and a lot of data science folks have exited Twitter for Mastodon, especially Fosstodon.

Copy link

HI julia ,
I have not found a "search" button on your website / blog so that I can find what am looking for in less time and effort , that's why in part am writing to you here , I have a question regarding "pins" package , let say I have the following URL "https://www.msn.com/en-us/weather/hourlyforecast/in-%C%89cublens,Vaud?loc=eyJsIjoiw4ljdWJsZW5zIiwiciI6IlZhdWQiLCJjIjoiU3dpdHplcmxhbmQiLCJpIjoiQ0giLCJnIjoiZW4tdXMiLCJ4IjoiNi41NjA5NzI2OTA1ODIyNzUiLCJ5IjoiNDYuNTE1ODg4MjE0MTExMzMifQ%3D%3D&weadegreetype=F" which is basically an hourly forecast of some important quantities that users usually check on a regular basis , then how do I can get these forecast and their actual counterparts to be saved in to a pin for further model use ? secondly there is a question of staleness of data , how one be able to automatize this dropping process of the old parts within the data sets and let the new stream of data sets in in "pins" pakage ?
and is there maximum limit on size of objects that can be stored within "pin" while not incurring waiting time penalty when accessing such contents of the "pinned content" by a user let say of shiny app or even a simpler plumber api ? I have checked the below page but it does not work
https://pins.rstudio.com/articles/using-board-url.html#publishing-platforms
am getting "Error in board_url():
! Failed to access manifest file at https://not.real.website.co/pins/_pins.yaml:
Caused by error in curl::curl_fetch_memory():"
on my local machine , nonetheless , it does not address adequately I believe the sorts of questions raised above.

I would really appreciate if you can just do an article on such aspects mentioned aspects of the package "pins" or probably if there is any other alternatives / packages that should be better tailored for the above mentioned tasks.

Your input is highly appreciated
Have yourself a good day

@juliasilge
Copy link
Owner

@ashraf-01

Can you create a reprex (a minimal reproducible example) for your problem? The goal of a reprex is to make it easier for us to recreate your problem so that we can understand it and/or fix it. If you've never heard of a reprex before, you may want to start with the tidyverse.org help page.

Once you have a reprex, I recommend posting on the pins GitHub repo, which is a great place for getting help with these kinds of pins questions. We talk about file size recommendations in this section. Thanks! 🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants