Collect comments youtube

The following seems to work. Is that your full error message? YouTube's api will usually give you a thread error.

Without more information about the error logs, I think the likely source of your issue is with configuring google's credentials for YouTube API. You can check that here: https://console.developers.google.com/apis/credentials

One note, your Collect call refers to Video_part10 for the youtube id. But above it, your code refers to Video. Be sure to be careful when you pose your reproducible examples here, since a poorly produced one can make it really hard for folks to help.

I'd definitely recommend in future creates minimal REPRoducible EXample (reprex)? This'll also auto-format your code, help make sure you include any required library calls, and otherwise is just the polite way to seek help with coding problems online. Below is an example of one.



library(dplyr)
library(vosonSML)

# This needs to be configured correctly at https://console.developers.google.com/apis/credentials
myAPIKey <- "XXXX" # <- your real api key

videoIDs <- "SBr6hKLQ2M8"
youtubeAuth <- Authenticate("youtube", apiKey = myAPIKey)
youtubeData <- youtubeAuth %>% 
  Collect(videoIDs = videoIDs, writeToFile = TRUE, verbose = FALSE, maxComments = 200)
#> Collecting comment threads for youtube videos...
#> Video 1 of 1
#> ---------------------------------------------------------------
#> ** video Id: SBr6hKLQ2M8
#> ** Collected threads: 81
#> 
#> ** Total comments collected for all videos 81.
#> (Estimated API unit cost: 3)
#> RDS file written: /private/var/folders/nc/6s62d32s3rn858f08kym2k8c0000gn/T/RtmpnwElOp/reprex6561492eb4f3/2020-04-29_103454-YoutubeData.rds
#> Done.
youtubeData
#> # A tibble: 81 x 12
#>    Comment AuthorDisplayNa… AuthorProfileIm… AuthorChannelUrl AuthorChannelID
#>    <chr>   <chr>            <chr>            <chr>            <chr>          
#>  1 "mdr m… Ossema Lahbib    https://yt3.ggp… http://www.yout… UCqAk49fOPX9kx…
#>  2 "Nul a… Edouard Auber    https://yt3.ggp… http://www.yout… UCyhVcxOW4mCx2…
#>  3 "pt un… Sim on           https://yt3.ggp… http://www.yout… UC5-3jqRJdyhWK…
#>  4 "même … Gotti Tony       https://yt3.ggp… http://www.yout… UC0GHM5WzYY1eH…
#>  5 "trop … The Farm House   https://yt3.ggp… http://www.yout… UC91H-DU34DzAS…
#>  6 "Mes j… Kevin Garguier   https://yt3.ggp… http://www.yout… UCpTA7N5SDsl0h…
#>  7 "C'est… Christine ORS    https://yt3.ggp… http://www.yout… UCMB6ZnMBsnYT2…
#>  8 "c'est… Greg Demirdjian  https://yt3.ggp… http://www.yout… UCHAij2gsxxP-k…
#>  9 "Oh pu… Falsorr          https://yt3.ggp… http://www.yout… UCrwGLxwAVN2Wv…
#> 10 "XD pu… Vladimir Nyström https://yt3.ggp… http://www.yout… UCmirqJnH93kHP…
#> # … with 71 more rows, and 7 more variables: ReplyCount <chr>, LikeCount <chr>,
#> #   PublishedAt <chr>, UpdatedAt <chr>, CommentID <chr>, ParentID <chr>,
#> #   VideoID <chr>

Created on 2020-04-29 by the reprex package (v0.3.0)

1 Like