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.