if (FALSE) {
# Set API token via yt_oauth() first
# Single video
get_stats(video_ids="N708P-A45D0")
# Multiple videos (automatic batching)
video_ids <- c("N708P-A45D0", "M7FIvfx5J10", "kJQP7kiw5Fk")
stats_df <- get_stats(video_ids)
# Include video duration and other content details:
get_stats(video_ids="N708P-A45D0", include_content_details = TRUE)
# For unlisted videos, must authenticate as channel owner:
# yt_oauth("your_client_id", "your_client_secret")
# get_stats(video_ids="your_unlisted_video_id")
}
Run the code above in your browser using DataLab