Skip to content

Commit

Permalink
updated vignette and readme
Browse files Browse the repository at this point in the history
  • Loading branch information
JBGruber committed Oct 8, 2024
1 parent 47d8477 commit c2a8843
Show file tree
Hide file tree
Showing 8 changed files with 315 additions and 122 deletions.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export(tt_get_liked)
export(tt_get_pinned)
export(tt_get_reposted)
export(tt_json)
export(tt_playlist)
export(tt_playlist_api)
export(tt_query_videos)
export(tt_request_hidden)
Expand Down
6 changes: 6 additions & 0 deletions R/api_research.r
Original file line number Diff line number Diff line change
Expand Up @@ -901,6 +901,12 @@ api_error_handler <- function(resp) {
api_user_error_checker <- function(resp) {
if (httr2::resp_status(resp) < 400L) return(FALSE)
if (httr2::resp_status(resp) == 404L) return(TRUE)
# it looks like the API sometimes returns 500 falsely, but in these cases, no
# error message is present
if (httr2::resp_status(resp) == 500L &&
!purrr::pluck_exists(httr2::resp_body_json(resp), "error", "message")) {
return(FALSE)
}
# if likes can't be accessed, which is true for many users, this should
# not throw an error
if (grepl("information.cannot.be.returned",
Expand Down
5 changes: 5 additions & 0 deletions R/shorthands.r
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ tt_videos <- function(...) {
tt_user_info <- tt_user_info_api


#' @rdname tt_playlist_api
#' @export
tt_playlist <- tt_playlist_api


#' @rdname tt_user_liked_videos_api
#' @export
tt_get_liked <- tt_user_liked_videos_api
Expand Down
6 changes: 3 additions & 3 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ knitr::opts_chunk$set(
| get comments under a video | tt_comments | tt_comments_api | \- |
| get who follows a user | tt_get_follower | tt_user_follower_api | tt_get_follower_hidden |
| get who a user is following | tt_get_following | tt_user_following_api | tt_get_following_hidden |
| get videos a user liked | tt_get_liked | tt_user_liked_videos_api | \-
| ??? | | tt_user_pinned_videos_api | \-
| ??? | | tt_playlist_info_api | \-
| get videos a user liked | tt_get_liked | tt_user_liked_videos_api | \- |
| get pinned videos of users | tt_get_pinned | tt_user_pinned_videos_api | \- |
| get videos in a playlist | tt_playlist | tt_playlist_api | \- |
| get raw video data | \- | \- | tt_request_hidden |
| authenticate a session | \- | auth_research | auth_hidden |

Expand Down
24 changes: 14 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,20 @@ coverage](https://codecov.io/gh/JBGruber/traktok/branch/main/graph/badge.svg)](h

## Feature overview

| Description | Shorthand | Research API | Hidden API |
|:----------------------------|:-----------------|:-----------------|:------------------------|
| search videos | tt_search | tt_search_api | tt_search_hidden |
| get video detail (+file) | tt_videos | \- | tt_videos_hidden |
| get user videos | tt_user_info | tt_user_info_api | \- |
| get comments under a video | tt_comments | tt_comments_api | \- |
| get who follows a user | tt_get_follower | \- | tt_get_follower_hidden |
| get who a user is following | tt_get_following | \- | tt_get_following_hidden |
| get raw video data | \- | \- | tt_request_hidden |
| authenticate a session | \- | auth_research | auth_hidden |
| Description | Shorthand | Research API | Hidden API |
|:----------------------------|:-----------------|:--------------------------|:------------------------|
| search videos | tt_search | tt_search_api | tt_search_hidden |
| get video detail (+file) | tt_videos | \- | tt_videos_hidden |
| get user videos | tt_user_info | tt_user_info_api | tt_user_videos_hidden |
| get user info | tt_user_info | tt_user_info_api | tt_user_videos_hidden |
| get comments under a video | tt_comments | tt_comments_api | \- |
| get who follows a user | tt_get_follower | tt_user_follower_api | tt_get_follower_hidden |
| get who a user is following | tt_get_following | tt_user_following_api | tt_get_following_hidden |
| get videos a user liked | tt_get_liked | tt_user_liked_videos_api | \- |
| get pinned videos of users | tt_get_pinned | tt_user_pinned_videos_api | \- |
| get videos in a playlist | tt_playlist | tt_playlist_api | \- |
| get raw video data | \- | \- | tt_request_hidden |
| authenticate a session | \- | auth_research | auth_hidden |

The goal of traktok is to provide easy access to TikTok data. This
package one started as an R port of Deen Freelon’s
Expand Down
5 changes: 4 additions & 1 deletion man/tt_playlist_api.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit c2a8843

Please sign in to comment.