Learn R Programming

:sweet_potato: tuber: Access YouTube API via R

Access YouTube API via R. Get comments posted on YouTube videos, get information on how many times a video has been liked, search for videos with particular content, and much more. You can also get closed captions of videos you own. To learn more about the YouTube API, see https://developers.google.com/youtube/v3/.

Installation

To get the current development version from GitHub:

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

To get a quick overview of some important functions in tuber, check out this article.

Using tuber

To get going, get the application id and password from the Google Developer Console (see https://developers.google.com/youtube/v3/getting-started). Enable all the 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("app_id", "app_password")

If your session cannot open a browser window for authentication, pass use_oob = TRUE to yt_oauth() so that authentication can be completed via an out-of-band code.

To force re-authentication at any time, delete the .httr-oauth file in your working directory.

Note: If you are on ubuntu, you may have to run the following before doing anything:

httr::set_config(httr::config( ssl_verifypeer = 0L ) )

Get Statistics of a Video

get_stats(video_id = "N708P-A45D0")

Get Information About a Video

get_video_details(video_id = "N708P-A45D0")

Get Captions of a Video

get_captions(video_id = "yJXTXN4xrI8")

Note: It was previously possible to get captions for all videos that had “Community contributions” enabled. However, since YouTube removed that option in September 2020, the get_captions function now only works for videos created with the same account as the API credentials you use. An alternative for collecting YouTube video captions is the youtubecaption package.

Search Videos

yt_search("Barack Obama")

Get All the Comments Including Replies

get_all_comments(video_id = "a-UQz7fqR3w")

License

Scripts are released under the MIT License.

Contributor Code of Conduct

The project welcomes contributions from everyone! In fact, it depends on it. To maintain this welcoming atmosphere, and to collaborate in a fun and productive way, we expect contributors to the project to abide by the Contributor Code of Conduct.

Copy Link

Version

Install

install.packages('tuber')

Monthly Downloads

621

Version

1.1.0

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Gaurav Sood

Last Published

August 25th, 2025

Functions in tuber (1.1.0)

get_all_channel_video_stats

Get statistics on all the videos in a Channel
get_playlists

Get Playlists
list_channel_activities

List Channel Activity
list_videos

List (Most Popular) Videos
list_regions

List Content Regions That YouTube Currently Supports
list_my_videos

List My videos
get_subscriptions

Get Subscriptions
get_stats

Get statistics of a Video
list_channel_resources

Returns List of Requested Channel Resources
list_videocats

List of Categories That Can be Associated with Videos
get_video_details

Get Details of a Video or Videos
list_abuse_report_reasons

List reasons that can be used to report abusive videos
list_langs

List Languages That YouTube Currently Supports
tuber_DELETE

DELETE
list_guidecats

Get list of categories that can be associated with YouTube channels
tuber

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

tuber: Client for the YouTube API
tuber_GET

GET
get_playlist_item_ids

Get Playlist Item IDs
get_related_videos

Get Related Videos
quota_management

YouTube API Quota Management
read_sbv

Read SBV file
list_caption_tracks

List Captions of a Video
yt_key

Manage YouTube API key
tuber_POST_json

POST encoded in json
tuber_POST

POST
process_youtube_text

Apply Unicode Handling to YouTube API Response
list_captions

Upload Video to Youtube
list_channel_sections

List Channel Sections
%>%

Pipe operator
tuber_check

Request Response Verification
yt_oauth

Set up Authorization
upload_caption

Upload Video Caption to Youtube
update_video_metadata

Update a YouTube Video's Metadata
list_channel_videos

Returns List of Requested Channel Videos
safe_utf8

Safely Convert Text to UTF-8
upload_video

Upload Video to Youtube
yt_get_quota_usage

Get Current Quota Usage
track_quota_usage

Track Quota Usage
yt_reset_quota

Reset Quota Counter
yt_set_quota_limit

Set Quota Limit
yt_search

Search YouTube
yt_token

Check if authentication token is in options
unicode_utils

Unicode and Text Processing Utilities
yt_topic_search

Search YouTube by Topic It uses the Freebase list of topics
delete_comments

Delete a Particular Comment
clean_youtube_text

Clean and Normalize YouTube Text Data
create_playlist

Create New Playlist
delete_playlist_items

Delete a Playlist Item
change_playlist_title

Change the title of a YouTube playlist.
add_video_to_playlist

Add Video to Playlist
delete_captions

Delete a Particular Caption Track
delete_channel_sections

Delete Channel Sections
delete_videos

Delete a Video
delete_playlists

Delete a Playlist
get_channel_stats

Get statistics of a Channel
get_captions

Get Particular Caption Track
get_comments

Get Comments
get_all_comments

Get all the comments for a video including replies
exponential_backoff

Add Exponential Backoff
get_comment_threads

Get Comments Threads
get_playlist_item_videoids

Get Playlist Item Video IDs
get_playlist_items

Get Playlist Items