juliasilge.com icon indicating copy to clipboard operation
juliasilge.com copied to clipboard

Delete all your tweets using rtweet | Julia Silge

Open utterances-bot opened this issue 2 years ago • 9 comments

Delete all your tweets using rtweet | Julia Silge

A data science blog

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

utterances-bot avatar Nov 15 '22 06:11 utterances-bot

Wonderful. Wondering how to unlike all liked tweets

myaseen208 avatar Nov 15 '22 06:11 myaseen208

@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.

juliasilge avatar Nov 15 '22 18:11 juliasilge

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
]

mcanouil avatar Nov 21 '22 22:11 mcanouil

@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.

myaseen208 avatar Dec 01 '22 10:12 myaseen208

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.

mcanouil avatar Dec 01 '22 11:12 mcanouil

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?

michaellomuscio avatar Dec 08 '22 20:12 michaellomuscio

@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.

juliasilge avatar Dec 08 '22 22:12 juliasilge

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

ashraf-01 avatar Aug 14 '23 10:08 ashraf-01

@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! 🙌

juliasilge avatar Aug 14 '23 17:08 juliasilge