Skip to content

Instantly share code, notes, and snippets.

@hadley
Last active May 19, 2021
Embed
What would you like to do?
library(rtweet)
library(tidyverse)
rt <- search_tweets("#rstats", n = 5000, include_rts = FALSE)
existing <- rtweet:::TWIT_get(NULL, "/1.1/mutes/users/ids", params = list(stringify_ids = TRUE))
danger_list <- c("Serverless", "IoT", "IIoT", "AI", "100DaysOfCode", "DEVCommunity", "FemTech")
spam <- rt %>%
rowwise() %>%
filter(any(hashtags %in% danger_list)) %>%
filter(!user_id %in% existing$ids) %>%
select(screen_name, text)
spam %>% count(screen_name, sort = TRUE)
to_mute <- spam %>% pull(screen_name) %>% unique() %>% sort()
walk(new_mute, function(id) {
message("Muting ", id)
post_mute(id)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment