JBGruber / traktok

The goal of traktok is to provide easy access to TikTok data.
https://jbgruber.github.io/traktok/
60 stars 4 forks source link

Unofficial API stopped working - does not find JSONs #12

Closed arodloff closed 9 months ago

arodloff commented 9 months ago

Basically every function stopped working. With an older version of this package everything worked fine but even when trying to revert to the old version everything stopped working.

Example with tt_videos_hidden:

> url_acc = 'https://www.tiktok.com/@tiktok'
> url_vid = 'https://www.tiktok.com/@tiktok/video/7312239171375090974'
> library(traktok)
> cookiemonster::add_cookies("cookies.txt")
✔ Cookies for tiktok.com, www.tiktok.com put in the jar!
> tt_videos_hidden(url_vid)
Error in `purrr::map()`:71375090974
ℹ In index: 1.
Caused by error in `if (nchar(out) < 10) ...`:
! missing value where TRUE/FALSE needed
Run `rlang::last_trace()` to see where the error occurred.
✖ Getting video 7312239171375090974 [2.4s]

Example with tt_request_hidden:

> tt_request_hidden(url_acc)
Error in if (nchar(out) < 10) stop("no json found") : 
  missing value where TRUE/FALSE needed

Example from your article:

rstats_df <- tt_search_hidden("#rstats", max_pages = 2)
✔ Got page 1. Found 1 videos. [1.5s]
> rstats_df
# A tibble: 0 × 20
# ℹ 20 variables: video_id <chr>, video_timestamp <dttm>, video_url <glue>,
#   video_length <int>, video_title <chr>, video_diggcount <int>,
#   video_sharecount <int>, video_commentcount <int>, video_playcount <int>,
#   video_is_ad <lgl>, author_name <chr>, author_nickname <chr>,
#   author_followercount <int>, author_followingcount <int>, author_heartcount <int>,
#   author_videocount <int>, author_diggcount <int>, music <list>, challenges <list>,
#   download_url <chr>

R version: 4.3.2 traktok version: 0.0.3.9000

JBGruber commented 9 months ago

Looks like they moved the data to a different location and changed how the JSON string looks. But it seems the relevant data is still there. Let me see what I can do...

JBGruber commented 9 months ago

Fix/test:

JBGruber commented 9 months ago

It's all back up and running again. And the new format is even better! Now there is finally a way to get the secUid, which is needed to request following/follower from an account:

library(traktok)
video_df <- tt_videos("https://www.tiktok.com/@tiktok/video/7106594312292453675", max_tries = 1L)
following_df <- tt_get_following(video_df$author_secuid)
follower_df <- tt_get_follower(video_df$author_secuid)