The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.

Using tubern

Gaurav Sood

2017-04-13

tubern: Access YouTube Analytics API via R

Install, Load the package

To install the latest version from CRAN:

install.packages("tubern")

The latest development version of the package will always be on GitHub. Instructions for installing the package from Github are provided below.

# install.packages('devtools')
devtools::install_github("soodoku/tubern", build_vignettes = TRUE)

Next, load the package:

library(tubern)

Using the package

To get going, get the application id and password from Google Developer Console (see https://developers.google.com/youtube/reporting/). Enable YouTube APIs. Then set the application id and password via the yt_oauth function. For more information about YouTube OAuth, see YouTube OAuth Guide.

yt_oauth("998136489867-5t3tq1g7hbovoj46dreqd6k5kd35ctjn.apps.googleusercontent.com", "MbOSt6cQhhFkwETXKur-L9rN")
## Waiting for authentication in browser...
## Press Esc/Ctrl + C to abort
## Authentication complete.

Get Statistics of a Video

get_report(ids = "channel==MINE", metrics = "views", start_date = "2010-04-01", end_date ="2017-04-01")
## $kind
## [1] "youtubeAnalytics#resultTable"

## $columnHeaders
## $columnHeaders[[1]]
## $columnHeaders[[1]]$name
## [1] "views"

## $columnHeaders[[1]]$columnType
## [1] "METRIC"

## $columnHeaders[[1]]$dataType
## [1] "INTEGER"



## $rows
## $rows[[1]]
## $rows[[1]][[1]]
## [1] 6

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.