twitter03

textmining
twitter
Published

October 28, 2022

Exercise

Laden Sie die neuesten Tweets an karl_lauterbach herunter, die mindestens 100 Likes oder 100 Retweets haben.











Solution

library(tidyverse)
── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ dplyr     1.1.3     ✔ readr     2.1.4
✔ forcats   1.0.0     ✔ stringr   1.5.0
✔ ggplot2   3.4.4     ✔ tibble    3.2.1
✔ lubridate 1.9.3     ✔ tidyr     1.3.0
✔ purrr     1.0.2     
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag()    masks stats::lag()
ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(rtweet)

Attaching package: 'rtweet'

The following object is masked from 'package:purrr':

    flatten

Einloggen bei Twitter; zuerst die Credentials bereithalten:

source("/Users/sebastiansaueruser/credentials/hate-speech-analysis-v01-twitter.R")

Dann anmelden:

auth <- rtweet_app(bearer_token = Bearer_Token)

Tweets an Karl Lauterbach suchen:

karl1 <- search_tweets("@karl_lauterbach min_faves:100 OR min_retweets:100", n = 10)
karl1 %>% 
  select(retweet_count, favorite_count)
# A tibble: 10 × 2
   retweet_count favorite_count
           <int>          <int>
 1            56            210
 2            56            229
 3            44           1626
 4            60            225
 5            30            494
 6             5            148
 7            27            435
 8            12            178
 9            13            162
10            46            375

Categories:

  • textmining
  • twitter