This function reads YouTube video urls from a list and or a text file and converts them to a vector of video ids. For example, URL https://www.youtube.com/watch?v=73I5dRucCds returns the id 73I5dRucCds. This function can be used to create a vector for the YouTube Collect.youtube functions videoIDs parameter.

GetYoutubeVideoIDs(urls = NULL, file = NULL)

Arguments

urls

Character vector. List of YouTube urls.

file

Character string. Text file containing YouTube urls, one per line.

Value

A vector of YouTube video ids as character strings that were extracted from input video urls.

Note

Accepts YouTube url formats https://youtu.be/xxxxxxxx and https://www.youtube.com/watch?v=xxxxxxxx.