Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get_comment_threads repeats 100 most recent comments #107

Open
jobreu opened this issue Mar 1, 2021 · 2 comments
Open

get_comment_threads repeats 100 most recent comments #107

jobreu opened this issue Mar 1, 2021 · 2 comments
Labels

Comments

@jobreu
Copy link
Contributor

jobreu commented Mar 1, 2021

The function get_comment_threads() does not collect all comments when the argument max_results is set to be > 100. Instead, it repeats the most recent 100 comments as often as necessary to reach a number of rows that seems to be equivalent to the total number of comments (minus the replies).

@soodoku soodoku added the bug label Mar 1, 2021
@TimBMK
Copy link
Contributor

TimBMK commented Feb 15, 2023

To add to this: the function does not simplify with simplify = T if part = "snippet" or part = "id, snippet". It is also unable to retrieve more than 100 results if simplify = F, but this is quite obviously related to the fact that it does never really return more than 100 results (thanks for the pointer, I was just trying to figure out what's wrong here!)

@soodoku
Copy link
Member

soodoku commented Feb 20, 2023

can you all help me debug? code snippet =

simple_res  <- lapply(res$items, function(x) {
                                     unlist(x$snippet$topLevelComment$snippet)
                                     }
                                     )
    simpler_res <- ldply(simple_res, rbind)

    agg_res <- simpler_res
    page_token  <- res$nextPageToken

    while ( is.character(page_token)) {

      a_res <- get_comment_threads(orig_filter,
                                 part = part,
                                 text_format = text_format,
                                 simplify = FALSE,
                                 max_results = 100,
                                 page_token = page_token
                                )
      simple_res  <- lapply(res$items, function(x) {
                                     unlist(x$snippet$topLevelComment$snippet)
                                     }
                                     )
      simpler_res <- ldply(simple_res, rbind)

      agg_res <- rbind(simpler_res, agg_res)
      page_token  <- a_res$nextPageToken

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants