
Last chance! 50% off unlimited learning
Sale ends in
CollectDataYoutube(videoIDs, apiKeyYoutube, verbose, writeToFile, maxComments)
videoIDs='W2GZFeYGU3s'
. For multiple videos, the function
GetYoutubeVideoIDs
can be used to create a vector object suitable as
input for videoIDs
.TRUE
then this function will output
runtime information to the console as it computes. Useful diagnostic tool
for long computations. Default is FALSE
.TRUE
then the data is saved to file in
current working directory (CSV format), with filename denoting current
system time. Default is FALSE
.maxComments
. By default this
function attempts to collect all comments.dataSource.youtube
that can be
used for creating unimodal networks (CreateActorNetwork
).dataSource.youtube
,
ready for creating networks for further analysis.CollectDataYoutube
collects public comments from YouTube videos,
using the YouTube API.
The function then finds and maps the relationships of YouTube users who have
interacted with each other (i.e. user i has replied to user j or mentioned
user j in a comment) and structures these relationships into a data frame
format suitable for creating unimodal networks (CreateActorNetwork
).
For multiple videos, the user may wish to use the function
GetYoutubeVideoIDs
, which creates a character vector of video IDs
from a plain text file of YouTube video URLs, which can then be used for the
videoIDs
argument of the function CollectDataYoutube
.
AuthenticateWithYoutubeAPI
must be run first or no data will
be collected.
## Not run: ------------------------------------
# # Use your own Google Developer API Key here:
# myApiKey <- "1234567890"
#
# # Authenticate with the Google API
# apiKeyYoutube <- AuthenticateWithYoutubeAPI(apiKeyYoutube=myApiKey)
#
# # Generate a vector of YouTube video IDs to collect data from
# # (or use the function `GetYoutubeVideoIDs` to automatically
# # generate from a plain text file of video URLs)
# videoIDs <- c("W2GZFeYGU3s","mL27TAJGlWc")
#
# # Collect the data using function `CollectDataYoutube`
# myYoutubeData <- CollectDataYoutube(videoIDs,apiKeyYoutube,writeToFile=FALSE)
#
# # Create an 'actor' network using the function `CreateActorNetwork`
# g_actor_youtube <- CreateActorNetwork(myYoutubeData)
## ---------------------------------------------
Run the code above in your browser using DataLab