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)

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")

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

633

Version

1.0.1

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Gaurav Sood

Last Published

April 1st, 2025

Functions in tuber (1.0.1)

get_captions

Get Particular Caption Track
list_channel_sections

List Channel Sections
list_abuse_report_reasons

List reasons that can be used to report abusive videos
get_video_details

Get Details of a Video or Videos
get_comment_threads

Get Comments Threads
list_captions

Upload Video to Youtube
tuber

tuber provides access to the YouTube API V3.
list_caption_tracks

List Captions of a Video
get_playlist_item_ids

Get Playlist Item IDs
tuber-package

tuber: Client for the YouTube API
tuber_DELETE

DELETE
list_videocats

List of Categories That Can be Associated with Videos
list_channel_videos

Returns List of Requested Channel Videos
list_videos

List (Most Popular) Videos
tuber_GET

GET
read_sbv

Read SBV file
get_subscriptions

Get Subscriptions
get_playlist_items

Get Playlist Items
get_stats

Get statistics of a Video
%>%

Pipe operator
list_channel_activities

List Channel Activity
tuber_POST

POST
tuber_POST_json

POST encoded in json
yt_search

Search YouTube
list_regions

List Content Regions That YouTube Currently Supports
list_my_videos

List My videos
upload_video

Upload Video to Youtube
upload_caption

Upload Video Caption to Youtube
update_video_metadata

Update a YouTube Video's Metadata
tuber_check

Request Response Verification
list_channel_resources

Returns List of Requested Channel Resources
yt_topic_search

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

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

Manage YouTube API key
list_langs

List Languages That YouTube Currently Supports
yt_oauth

Set up Authorization
yt_token

Check if authentication token is in options
add_video_to_playlist

Add Video to Playlist
delete_comments

Delete a Particular Comment
get_all_channel_video_stats

Get statistics on all the videos in a Channel
delete_channel_sections

Delete Channel Sections
delete_playlists

Delete a Playlist
create_playlist

Create New Playlist
change_playlist_title

Change the title of a YouTube playlist.
delete_videos

Delete a Video
delete_playlist_items

Delete a Playlist Item
delete_captions

Delete a Particular Caption Track
get_playlists

Get Playlists
get_all_comments

Get all the comments for a video including replies
get_channel_stats

Get statistics of a Channel
get_playlist_item_videoids

Get Playlist Item Video IDs
get_comments

Get Comments
get_related_videos

Get Related Videos