From 7f628bc5bf96cdf8a32bd3ba1723846914ba7913 Mon Sep 17 00:00:00 2001 From: JBGruber Date: Fri, 1 Nov 2024 12:51:46 +0100 Subject: [PATCH] fix doc issues --- NAMESPACE | 1 + R/api_research.r | 1 - R/api_research_extended.r | 11 +++++++++-- R/parse_hidden.r | 9 +++++---- man/tt_user_info_api.Rd | 2 -- man/tt_user_videos_api.Rd | 12 ++++++++++-- 6 files changed, 25 insertions(+), 11 deletions(-) diff --git a/NAMESPACE b/NAMESPACE index bc9e938..a9dd7d6 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -41,3 +41,4 @@ export(tt_user_videos_api) export(tt_user_videos_hidden) export(tt_videos) export(tt_videos_hidden) +importFrom(rlang,.data) diff --git a/R/api_research.r b/R/api_research.r index 2384fdb..c383372 100644 --- a/R/api_research.r +++ b/R/api_research.r @@ -671,7 +671,6 @@ tt_user_request <- function(endpoint, #' @description \ifelse{html}{\figure{api-research.svg}{options: alt='[Works on: #' Research API]'}}{\strong{[Works on: Research API]}} #' -#' @param ... additional arguments handed to \link{tt_search_api}. #' @inheritParams tt_user_liked_videos_api #' #' @return A data.frame of parsed TikTok videos the user has posted diff --git a/R/api_research_extended.r b/R/api_research_extended.r index 5db23dd..9164636 100644 --- a/R/api_research_extended.r +++ b/R/api_research_extended.r @@ -10,6 +10,7 @@ #' \link{tt_user_videos_hidden} for the unofficial API version. #' #' @param username The username or usernames whose videos you want to retrieve. +#' @param since limit from when on to go through the account in 30 day windows. #' @param ... Additional arguments to be passed to the #' \code{\link{tt_search_api}} function. #' @@ -17,8 +18,14 @@ #' #' @examples #' \dontrun{ -#' # Get hidden videos from the user "fpoe_at" -#' tt_user_videos_api("fpoe_at") +#' # Get videos from the user "fpoe_at" since October 2024 +#' tt_user_videos_api("fpoe_at", since = "2024-10-01") +#' +#' # often makes sense to combine this with the account creation time from the +#' # hidden URL +#' fpoe_at_info <- tt_user_info_hidden(username = "fpoe_at") +#' tt_user_videos_api("fpoe_at", since = fpoe_at_info$create_time) +#' #' } #' @export tt_user_videos_api <- function(username, diff --git a/R/parse_hidden.r b/R/parse_hidden.r index 6ec348b..c6fe34d 100644 --- a/R/parse_hidden.r +++ b/R/parse_hidden.r @@ -161,6 +161,7 @@ parse_search <- function(res) { #' @noRd +#' @importFrom rlang .data parse_user <- function(user_data) { user_info <- spluck(user_data, "__DEFAULT_SCOPE__", "webapp.user-detail", "userInfo") @@ -171,10 +172,10 @@ parse_user <- function(user_data) { purrr::list_flatten() |> tibble::as_tibble(.name_repair = clean_names) |> # for minimal backwards compatibility - dplyr::rename(user_name = unique_id, - secUid = sec_uid) |> - dplyr::mutate(create_time = as_datetime(create_time), - nick_name_modify_time = as_datetime(nick_name_modify_time)) + dplyr::rename(user_name = .data$unique_id, + secUid = .data$sec_uid) |> + dplyr::mutate(create_time = as_datetime(.data$create_time), + nick_name_modify_time = as_datetime(.data$nick_name_modify_time)) } diff --git a/man/tt_user_info_api.Rd b/man/tt_user_info_api.Rd index 0819b4e..ccd2333 100644 --- a/man/tt_user_info_api.Rd +++ b/man/tt_user_info_api.Rd @@ -18,8 +18,6 @@ tt_user_info(username, fields = "all", verbose = TRUE, token = NULL) \item{token}{The authentication token (usually supplied automatically after running auth_research once)} - -\item{...}{additional arguments handed to \link{tt_search_api}.} } \value{ A data.frame of parsed TikTok videos the user has posted diff --git a/man/tt_user_videos_api.Rd b/man/tt_user_videos_api.Rd index dfaf455..4edf426 100644 --- a/man/tt_user_videos_api.Rd +++ b/man/tt_user_videos_api.Rd @@ -9,6 +9,8 @@ tt_user_videos_api(username, since = "2020-01-01", verbose = TRUE, ...) \arguments{ \item{username}{The username or usernames whose videos you want to retrieve.} +\item{since}{limit from when on to go through the account in 30 day windows.} + \item{verbose}{should the function print status updates to the screen?} \item{...}{Additional arguments to be passed to the @@ -26,7 +28,13 @@ tt_user_videos_api(username, since = "2020-01-01", verbose = TRUE, ...) } \examples{ \dontrun{ -# Get hidden videos from the user "fpoe_at" -tt_user_videos_api("fpoe_at") +# Get videos from the user "fpoe_at" since October 2024 +tt_user_videos_api("fpoe_at", since = "2024-10-01") + +# often makes sense to combine this with the account creation time from the +# hidden URL +fpoe_at_info <- tt_user_info_hidden(username = "fpoe_at") +tt_user_videos_api("fpoe_at", since = fpoe_at_info$create_time) + } }