Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
130 lines (86 sloc) 4.17 KB
output: github_document
[![Travis build status](](
[![AppVeyor Build Status](](
<!-- is generated from README.Rmd. Please edit that file -->
```{r setup, include = FALSE}
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
# GoT <img src="inst/GoT_sticker.png" width = "150" align="right" />
The goal of GoT is to help scraping some Game of Thrones data from the internet.
## Installation
You can install the development version from [GitHub]( with:
```{r, eval = FALSE}
# install.packages("devtools")
__Warning: This package scrapes data from the internet. Please be mindful of pinging servers too frequently and of the user agreements for sharing data.__
## Setup
This package is dependent on the `geniusr` package and you must have an API token. Go [here]( to create an account or login and obtain an API token. For more information on the API creation you can look at the genius documentation [here](!#%2Fgetting-started-h1).
Once you’ve created an account and obtained an API they’ll assign you a token. Be sure to copy the token. With the token copied you can add it to the R environment with some code.
Running the following code will open your .Renviron
```{r, eval = FALSE}
user_renviron = path.expand(file.path("~", ".Renviron"))
if(!file.exists(user_renviron)) # check to see if the file already exists
file.edit(user_renviron) # open with another text editor if this fails
Once this file is open paste the following into the script:
```{r, eval = FALSE}
If done properly then this code will return your API token.
```{r, eval = FALSE}
## Use
For a more thorough walkthrough please see my [blog post](
This package helps you scrape a the Game of Thrones scripts from []( and some character lists online.
To scrape the scripts from genius you can use `GoT::scrape_GoT()`.
base_url = ""
info = GoT::scrape_GoT(base_url = base_url, season = 7)
This function will scrape all the seasons up to the season indicated as the function input.
To clean this data somewhat, we can utilize `GoT::cleanGoT()`. This function generally tries to identify the speaking character and removes some of the stage direction or narration.
cleaned_data = GoT::cleanGoT(info)
We can also scrape character lists from two websites:
1. [](
2. [](
# Scrape wiki characters and save
url = ""
wiki_characters = GoT::scrape_characters(url)
# Scrape HBO characters and save
url = ''
hbo_characters = GoT::scrape_HBO_characters(url)
## Death Timeline
We can also obtain death timeline data from [](
death_times = GoT::get_death_times()
Unfortunately, this timeline only goes up to season 6 so I'll use a this article []( as a supplement.
url = ''
time.com_deaths = GoT::get_time.com_deaths(url = url)
You can’t perform that action at this time.