Learn R Programming

tuber

tuber is an R client for the YouTube Data API and selected YouTube Live Streaming API endpoints. It searches public YouTube data, retrieves channels, videos, playlists, comments, and captions, and supports common authenticated operations such as uploads, comment moderation, and playlist changes.

The package does not wrap every YouTube endpoint. Run vignette("api-conventions", package = "tuber") for the supported resources and known omissions.

Installation

Install the CRAN release:

install.packages("tuber")

Install the development version from GitHub:

# install.packages("pak")
pak::pak("gojiplus/tuber")

Authentication

Public read functions use an API key by default. Create a key in Google Cloud, enable the YouTube Data API v3 for that project, and set the key for the current R session:

yt_set_key("YOUR_YOUTUBE_API_KEY")

OAuth is required for private account data and every operation that changes YouTube data. Create a desktop OAuth client in Google Cloud, then authenticate in the system browser:

yt_oauth("YOUR_CLIENT_ID", "YOUR_CLIENT_SECRET")

yt_oauth() stores its token in the user's R cache directory by default. Pass an explicit token path if you need a different location. The file also holds your client secret, which is what lets later sessions call yt_oauth() with no arguments, so treat it as a credential.

Examples

Search for videos:

videos <- yt_search("Barack Obama", max_results = 25)

Retrieve fixed, snake-case video statistics:

stats <- get_video_stats("N708P-A45D0")

List a channel's playlists and the videos in one playlist:

playlists <- list_playlists(channel_id = "UCMtFAi84ehTSYSE9XoHefig")
items <- list_playlist_items(
  playlist_id = playlists$playlist_id[[1]],
  max_results = 100
)

Collect top-level comments and all replies:

comments <- get_all_comments("a-UQz7fqR3w", max_results = 500)

List and download caption tracks for a video owned by the authenticated account:

tracks <- list_captions("yJXTXN4xrI8")
caption <- download_caption(tracks$caption_id[[1]], as_raw = FALSE)

API conventions

  • list_*() functions mirror YouTube list endpoints and return a data frame by default. Use simplify = FALSE to keep the collected API response.
  • get_*() functions return a derived, enriched, or singular result.
  • Plural ID arguments accept vectors. Singular ID arguments accept one value.
  • max_results is the total result limit, even when the function makes several paginated requests.
  • Fixed simplified schemas use snake-case column names. The columns returned by get_video_details() depend on part and retain YouTube's field names.
  • Public reads default to auth = "key". Functions that can use either form of authentication accept auth = "key" or auth = "token". OAuth-only functions do not expose an auth argument.

License

tuber is released under the MIT License.

Copy Link

Version

Install

install.packages('tuber')

Monthly Downloads

806

Version

3.0.0

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Gaurav Sood

Last Published

November 5th, 2026

Functions in tuber (3.0.0)

get_video_broadcast_timing

Get video live-broadcast timing
delete_caption

Delete a Caption Track
get_all_comments

Get All Video Comments, Including Replies
delete_channel_section

Delete a Channel Section
insert_channel_banner

Insert Channel Banner
has_emoji

Detect emojis in text
get_video_thumbnails

Get video thumbnails information
helper-functions

Helper Functions for Common YouTube Analysis Tasks
get_channel_details

Get Channel Details
bulk_video_analysis

Bulk video performance analysis
get_all_channel_video_stats

Get statistics on all the videos in a Channel
get_cached_response

Get cached response if available and valid
build_comment_row

Build a standardized comment data frame row
is_cacheable_endpoint

Check if endpoint should be cached
generate_cache_key

Generate cache key for API request
list_channel_members

List Channel Members
delete_playlist

Delete a Playlist
handle_http_response

Warn when YouTube is rate limiting
list_captions

List Caption Tracks
list_channel_activities

List Channel Activities
list_channel_videos

Returns List of Requested Channel Videos
list_live_broadcasts

List live broadcasts
delete_comment

Delete a Comment
get_video_details

Get Video Details
list_languages

List Supported Languages
get_video_stats

Get Video Statistics
list_channel_sections

List Channel Sections
post_comment

Post a Top-Level Comment
tuber

tuber provides access to the YouTube API V3.
tuber-token

OAuth token storage and access
paginate_api_request

Paginate API requests with standardized pattern
tuber_perform

Perform a request and check the response
list_abuse_report_reasons

List Video-Abuse Report Reasons
is_transient_error

Check if an error is transient and worth retrying
list_regions

List Supported Content Regions
list_subscriptions

List Subscriptions
tuber_request

Build a request against the YouTube Data API
tuber_upload_file

Upload a file to a resumable session, resuming after interruptions
list_comment_threads

List Comment Threads
safe_extract

Safely extract field from list/object
list_popular_videos

List Most-Popular Videos
list_playlists

List Playlists
list_comments

List Comments or Replies
set_comment_moderation_status

Set Comment Moderation Status
list_live_chat_messages

List Live Chat Messages
yt_oauth

Set up Authorization
yt_reset_quota

Reset Quota Counter
tuber_upload_session

Open a resumable media upload session
tuber-package

tuber: Client for the YouTube Data API
print.tuber_result

Print method for tuber results
safe_nested

Safely extract nested field
suggest_solution

Provide helpful suggestions for common user errors
get_playlist_item_ids

Get Playlist-Item IDs
reply_to_comment

Reply to a Comment
quota_cost

Track Quota Usage
read_sbv

Read SBV file
list_my_videos

List My Videos
[.tuber_result

Subset method for tuber results
update_video_metadata

Update Video Metadata
tuber_info

Display tuber function metadata
list_video_categories

List Video Categories
list_super_chat_events

List Super Chat Events
remove_emojis

Remove emojis from text
tuber_json

Parse a JSON response body, tolerating an empty one
list_playlist_items

List Playlist Items
quota_management

YouTube API Quota Management
upload_video

Upload Video to YouTube
utils

Tuber Utility Functions
tuber_DELETE

DELETE
tuber_GET

GET
tuber_PUT

PUT
tuber_POST_json

POST encoded in json
yt_token

Check if authentication token is in options
summary.tuber_result

Summary method for tuber results
replace_emojis

Replace emojis in text
upload_caption

Upload a Caption Track
set_video_thumbnail

Set Video Thumbnail
store_cached_response

Store response in cache
tuber_cache_clear

Clear cache entries
tuber_cache_config

Configure caching settings
validate_rfc3339_date

Validate RFC 3339 date format for YouTube API
with_retry

Exponential backoff retry logic for API calls
tuber_cache_info

Get current cache configuration
tuber_check

Request Response Verification
tuber_write

Write request with a JSON body
yt_set_quota_limit

Set Quota Limit
unicode_utils

Unicode and Text Processing Utilities
yt_search

Search YouTube
yt_key

Manage YouTube API key
yt_get_quota_usage

Get Current Quota Usage
analyze_channel

Comprehensive channel analysis
analyze_trends

Trending analysis for search terms
call_api_with_retry

Wrapper for tuber API calls with built-in retry logic
caching

Response Caching for YouTube API
add_tuber_attributes

Add standardized metadata attributes to API response
create_playlist

Create New Playlist
count_emojis

Count emojis in text
add_video_to_playlist

Add Video to Playlist
change_playlist_title

Change a Playlist Title
compare_channels

Compare multiple channels
get_playlist_video_ids

Get Video IDs from a Playlist
download_caption

Download a Caption Track
error-handling

Tuber Error Handling Utilities
extended-endpoints

Extended YouTube API Endpoints
delete_playlist_item

Delete a Playlist Item
extract_emojis

Extract emojis from text
delete_video

Delete a Video