if (FALSE) {
# look for a keyword or hashtag by default
tt_search_api("rstats")
# or build a more elaborate query
query() |>
query_and(field_name = "region_code",
operation = "IN",
field_values = c("JP", "US")) |>
query_or(field_name = "hashtag_name",
operation = "EQ", # rstats is the only hashtag
field_values = "rstats") |>
query_or(field_name = "keyword",
operation = "IN", # rstats is one of the keywords
field_values = "rstats") |>
query_not(operation = "EQ",
field_name = "video_length",
field_values = "SHORT") |>
tt_search_api()
# when a search fails after a while, get the results and pick it back up
# (only work with same parameters)
last_pull <- last_query()
query() |>
query_and(field_name = "region_code",
operation = "IN",
field_values = c("JP", "US")) |>
query_or(field_name = "hashtag_name",
operation = "EQ", # rstats is the only hashtag
field_values = "rstats") |>
query_or(field_name = "keyword",
operation = "IN", # rstats is one of the keywords
field_values = "rstats") |>
query_not(operation = "EQ",
field_name = "video_length",
field_values = "SHORT") |>
tt_search_api(start_cursor = length(last_pull) + 1,
search_id = attr(last_pull, "search_id"))
}
Run the code above in your browser using DataLab