Error while Fetching data of YouTube Videos

I am trying to fetch the data from YouTube videos through R. But it gives me an error
"...Error in CollectDataYoutube(video, key, writeToFile = FALSE) :
No comment can be collected from the given videoIDs."

The R Code is as below

Get Social Media YouTube Data


Google Developer API Key

key <- "XXXXX" # API Key is not mentioned here while displaying. It is confidential.

Collect data using YouTube video IDs

video <- c("3gJngOCyrZg")
ytdata <- CollectDataYoutube(video, key, writeToFile = FALSE) # After executing this line, it gives mentioned error

I haven't used vosonSML, so I don't know much about the specific issue, but to make sure you have the best chances of getting an answer, it's worth ensuring that your question is in the right place!

Does this work for you in R, but not in RStudio? (see FAQ below for disambiguation)