Skip to contents

Retrieve a list of items in a given playlist.

Usage

get_playlist_items(
  playlist_id,
  max_results = 100,
  client = yt_construct_client(),
  cache_disk = getOption("yt_cache_disk", FALSE),
  cache_key = getOption("yt_cache_key", NULL),
  token = NULL
)

Arguments

playlist_id

The ID of a playlist.

max_results

The maximum number of results to return.

client

A YouTube OAuth client created with yt_construct_client().

cache_disk

Should the access token be cached on disk? This reduces the number of times that you need to re-authenticate at the cost of storing access credentials on disk. Cached tokens are encrypted and automatically deleted 30 days after creation.

cache_key

If you are authenticating with multiple users using the same client, use this key to differentiate between those users.

token

A YouTube API OAuth token, or the access_token string from such a token. We recommend that you instead supply a client, in which case an appropriate token will be located if possible.

Value

A list of videos, each of which has a videoId and a videoPublishedAt.

Examples

if (FALSE) { # yt_has_client_envvars() && interactive()
get_playlist_items(playlist_id = get_upload_playlist_id())
}