library(spotifyr)

Berikut merupakan package yang digunakan untuk melakukan scrapping spotify.

Sys.setenv(SPOTIFY_CLIENT_ID="0df59771076a4f648bc20ec5dec7dc8c")
Sys.setenv(SPOTIFY_CLIENT_SECRET="43dea5ddef7a4527a110f8f097cd29e0")
access_token<-get_spotify_access_token()

INFO ARTIS

artist_info<-search_spotify("Sabrina Carpenter", type = "artist")
artist_info
## # A tibble: 20 × 11
##    genres href   id    images name  popularity type  uri   external_urls.spotify
##    <list> <chr>  <chr> <list> <chr>      <int> <chr> <chr> <chr>                
##  1 <chr>  https… 74KM… <df>   Sabr…         91 arti… spot… https://open.spotify…
##  2 <chr>  https… 2kxP… <df>   NIKI          83 arti… spot… https://open.spotify…
##  3 <chr>  https… 5jnC… <df>   Sabr…          0 arti… spot… https://open.spotify…
##  4 <chr>  https… 66CX… <df>   Aria…         93 arti… spot… https://open.spotify…
##  5 <chr>  https… 20za… <df>   Nadi…         76 arti… spot… https://open.spotify…
##  6 <chr>  https… 3tMT… <df>   Juic…         76 arti… spot… https://open.spotify…
##  7 <chr>  https… 1McM… <df>   Oliv…         88 arti… spot… https://open.spotify…
##  8 <chr>  https… 4cgB… <df>   Afgan         71 arti… spot… https://open.spotify…
##  9 <chr>  https… 5LcN… <df>   Raim…         74 arti… spot… https://open.spotify…
## 10 <chr>  https… 49tQ… <df>   LANY          77 arti… spot… https://open.spotify…
## 11 <chr>  https… 5OZX… <df>   Raisa         64 arti… spot… https://open.spotify…
## 12 <chr>  https… 66Nm… <df>   Feby…         71 arti… spot… https://open.spotify…
## 13 <chr>  https… 4ubE… <df>   Hivi!         68 arti… spot… https://open.spotify…
## 14 <chr>  https… 7d86… <df>   Pamu…         71 arti… spot… https://open.spotify…
## 15 <chr>  https… 5JZ7… <df>   Lauv          77 arti… spot… https://open.spotify…
## 16 <chr>  https… 4dpA… <df>   Adele         86 arti… spot… https://open.spotify…
## 17 <chr>  https… 6YVM… <df>   aespa         79 arti… spot… https://open.spotify…
## 18 <chr>  https… 3Nrf… <df>   BTS           87 arti… spot… https://open.spotify…
## 19 <chr>  https… 6vP4… <df>   Tenxi         68 arti… spot… https://open.spotify…
## 20 <chr>  https… 1Jvb… <df>   Angg…         64 arti… spot… https://open.spotify…
## # ℹ 2 more variables: followers.href <lgl>, followers.total <int>

Memilih artis tertentu dengan mendeklarasikan namanya

selected_artist<-artist_info[1,]

Pemilihan artis

top_tracks<-get_artist_top_tracks(selected_artist$id, market = "ID")
top_tracks$name
##  [1] "Espresso"             "Taste"                "Please Please Please"
##  [4] "Busy Woman"           "Bed Chem"             "Juno"                
##  [7] "Nonsense"             "Feather"              "Good Graces"         
## [10] "15 Minutes"

Berikut merupakan top 10 judul lagu yang paling sering diputar dari penyanyi Sabrina Carpenter