tubern

R Client for the Youtube Analytics and Reporting API

https://github.com/gojiplus/tubern

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (12.0%) to scientific vocabulary

Keywords

youtube youtube-analytics youtube-api
Last synced: 9 months ago · JSON representation

Repository

R Client for the Youtube Analytics and Reporting API

Basic Info
Statistics
  • Stars: 12
  • Watchers: 2
  • Forks: 2
  • Open Issues: 2
  • Releases: 0
Topics
youtube youtube-analytics youtube-api
Created over 9 years ago · Last pushed 9 months ago
Metadata Files
Readme Changelog License

README.md

tubern: R Client for the YouTube Analytics and Reporting API

CRAN_Status_Badge R-CMD-check

tubern provides an R interface to the YouTube Analytics API v2, allowing you to retrieve YouTube Analytics data for channels and content owners. The package supports authentication via OAuth 2.0 and provides functions for getting analytics reports and managing channel groups.

Features

  • Analytics Reports: Retrieve detailed analytics data including views, likes, dislikes, watch time, and more
  • OAuth 2.0 Authentication: Secure authentication with YouTube Analytics API
  • Group Management: Create, list, update, and delete channel groups
  • Flexible Querying: Support for dimensions, filters, sorting, and date ranges
  • Content Owner Support: Access analytics for channels you manage as a content owner

Installation

From CRAN

r install.packages("tubern")

Development version from GitHub

```r

install.packages("devtools")

devtools::installgithub("soodoku/tubern", buildvignettes = TRUE) ```

Quick Start

1. Authentication

First, you need to set up OAuth 2.0 authentication. You'll need to create a Google Cloud project and obtain OAuth 2.0 credentials:

```r library(tubern)

Set up authentication (you'll need your own client ID and secret)

ytoauth(appid = "yourclientid.apps.googleusercontent.com", appsecret = "yourclient_secret") ```

2. Get Analytics Reports

```r

Get basic view statistics for your channel

report <- getreport( ids = "channel==MINE", metrics = "views,likes,dislikes,shares", startdate = "2024-01-01", end_date = "2024-12-31" )

Get data with dimensions

reportbyvideo <- getreport( ids = "channel==MINE", metrics = "views,averageViewDuration", dimensions = "video", startdate = "2024-01-01", enddate = "2024-12-31", maxresults = 25 ) ```

3. Manage Channel Groups

```r

List your channel groups

groups <- list_groups(filter = c(mine = TRUE))

Create a new group

newgroup <- addgroups( snippet = list( title = "My Channel Group", description = "A group for organizing my channels" ) ) ```

API Reference

Core Functions

  • yt_oauth(): Set up OAuth 2.0 authentication
  • get_report(): Retrieve YouTube Analytics reports
  • list_groups(): List channel groups
  • add_groups(): Create new channel groups
  • update_group(): Modify existing groups
  • delete_group(): Remove groups
  • list_group_items(): List items in a group
  • add_group_item(): Add channels to groups
  • delete_group_item(): Remove channels from groups

Available Metrics

Common metrics you can request include: - views: Number of times videos were viewed - likes, dislikes: Engagement metrics - shares: Number of times videos were shared - comments: Number of comments - subscribersGained, subscribersLost: Subscriber changes - estimatedMinutesWatched: Total watch time in minutes - averageViewDuration: Average time spent watching

For monetary metrics (requires monetary-analytics scope): - estimatedRevenue: Estimated revenue - adEarnings: Revenue from ads - impressionBasedCpm: Cost per thousand impressions

Available Dimensions

Dimensions allow you to segment your data: - video: Individual video performance - day: Daily breakdowns - country: Geographic data - deviceType: Desktop, mobile, tablet, etc. - operatingSystem: OS breakdowns - ageGroup, gender: Demographic data (limited availability)

Authentication Setup

  1. Go to the Google Cloud Console
  2. Create a new project or select an existing one
  3. Enable the YouTube Analytics API
  4. Create OAuth 2.0 credentials (Desktop application type)
  5. Use the client ID and secret in yt_oauth()

For detailed authentication instructions, see the YouTube Analytics API documentation.

Important Notes

  • API Changes: This package has been updated to use YouTube Analytics API v2. Some parameter names and behaviors may have changed from previous versions.
  • Rate Limits: The YouTube Analytics API has usage quotas. See the quota usage documentation for details.
  • Data Freshness: Analytics data typically has a delay of 24-72 hours.

Related Resources

License

Released under the MIT License.

Contributing

Contributions are welcome! Please read the Contributor Code of Conduct and submit issues or pull requests on GitHub.

Support

For bug reports and feature requests, please use the GitHub issue tracker.

Owner

  • Name: goji+
  • Login: gojiplus
  • Kind: organization

Useful tools for everyone

GitHub Events

Total
  • Push event: 5
Last Year
  • Push event: 5

Committers

Last synced: 10 months ago

All Time
  • Total Commits: 34
  • Total Committers: 1
  • Avg Commits per committer: 34.0
  • Development Distribution Score (DDS): 0.0
Past Year
  • Commits: 5
  • Committers: 1
  • Avg Commits per committer: 5.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
***** g****7@g****m 34

Issues and Pull Requests

Last synced: 10 months ago

All Time
  • Total issues: 2
  • Total pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Total issue authors: 2
  • Total pull request authors: 0
  • Average comments per issue: 0.5
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • cran 197 last-month
  • Total docker downloads: 21,247
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 2
  • Total maintainers: 1
cran.r-project.org: tubern

R Client for the YouTube Analytics and Reporting API

  • Versions: 2
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 197 Last month
  • Docker Downloads: 21,247
Rankings
Stargazers count: 16.3%
Forks count: 17.8%
Dependent packages count: 29.8%
Dependent repos count: 35.5%
Average: 36.3%
Downloads: 82.4%
Maintainers (1)
Last synced: 9 months ago

Dependencies

DESCRIPTION cran
  • R >= 3.2.0 depends
  • httr * imports
  • jsonlite * imports
  • knitr >= 1.11 suggests
  • lintr * suggests
  • rmarkdown * suggests
  • testthat * suggests
  • xml2 * suggests
.github/workflows/R-CMD-check.yaml actions
  • actions/checkout v4 composite
  • r-lib/actions/check-r-package v2 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/rhub.yaml actions
  • r-hub/actions/checkout v1 composite
  • r-hub/actions/platform-info v1 composite
  • r-hub/actions/run-check v1 composite
  • r-hub/actions/setup v1 composite
  • r-hub/actions/setup-deps v1 composite
  • r-hub/actions/setup-r v1 composite