From c948bda5d6f30929b448fe78a0920739d5792d4b Mon Sep 17 00:00:00 2001 From: attend-dunce <96889312+attend-dunce@users.noreply.github.com> Date: Fri, 31 Dec 2021 00:55:23 +0100 Subject: [PATCH 2/3] Added support for username as well as user id --- lib/TikTok/Api.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/TikTok/Api.php b/lib/TikTok/Api.php index 4a35f61..8fd42ae 100644 --- a/lib/TikTok/Api.php +++ b/lib/TikTok/Api.php @@ -385,7 +385,8 @@ if (!\class_exists('\Sovit\TikTok\Api')) { } } $username = urlencode($username); - $result = $this->remote_call("https://www.tiktok.com/api/user/detail/?userId={$username}", false); + $param = is_numeric($username) ? "userId" : "uniqueId"; + $result = $this->remote_call("https://www.tiktok.com/api/user/detail/?{$param}={$username}", false); $result = json_decode($result, false); if (isset($result->userInfo)) { $result = $result->userInfo; -- 2.34.1