Description Usage Arguments Details Value Author(s) References Examples
Use this function for downloading a desired YouTube video caption in a tidy tibble data_frame form and save it as an Excel file in your current working directory.
1 2 3 4 5 6 7 |
url |
A string value for a single YouTube video link URL. A typical form should start with "https://www.youtube.com/watch?v=" followed by a unique video ID. |
language |
two-character language code for the video URL. Set to "en" (English) by default. You can change this to fit with your needs (e.g., "ko" for Korean, "de" for German, etc.). |
savexl |
A logical value for determining whether or not to save the obtained tidy YouTube caption data as an Excel file. The default is FALSE which does not save it as a file. If set to TRUE, a file named "YouTube_caption_ |
openxl |
A logical value for determining whether or not to open, if any, the saved YouTube_caption Excel file in your working directory. The default is FALSE. TRUE works only when the preceding argument (i.e., savexl) is set to TRUE. |
path |
A character vector of full path names; the default corresponds to the working directory, getwd. Tilde expansion (see path.expand) is performed. Missing values will be ignored. |
get_caption
See example below.
tibble (advanced data.frame) object for a YouTube video caption will be returned.
JooYoung Seo, jooyoung@psu.edu
Soyoung Choi, sxc940@psu.edu
https://pypi.org/project/youtube-transcript-api/
1 2 3 4 5 6 7 8 9 | library(youtubecaption)
# Let's get the video caption out of Hadley Wickham's "You can't do data science in a GUI":
url <- "https://www.youtube.com/watch?v=cpbtcsGE0OA"
caption <- get_caption(url)
caption
# Save the caption as an Excel file and open it right it away
## Changing path to temp for the demonstration purpose only:
get_caption(url = url, savexl = TRUE, openxl = TRUE, path = tempdir())
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.