This repository was archived by the owner on Sep 19, 2024. It is now read-only.
File tree 3 files changed +6
-6
lines changed
3 files changed +6
-6
lines changed Original file line number Diff line number Diff line change 4
4
$ api = new \Sovit \TikTokPrivate \Api ([
5
5
"api_key " =>"XXX " ,
6
6
]);
7
- $ result = $ api ->getUser ("zachking " );
7
+ $ result = $ api ->getUserFromSearch ("zachking " );
8
8
echo json_encode ($ result , JSON_PRETTY_PRINT );
Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ class Api
51
51
private $ defaults = [
52
52
"proxy " => null ,
53
53
"cache_timeout " => 3600 ,
54
- "transform_result " => true ,
54
+ "transform_result " => false , // transform not recommended as tiktok json structure is always changing and can be broken at any time.
55
55
];
56
56
57
57
/**
@@ -346,8 +346,8 @@ public function getUserFromSearch($username)
346
346
throw new \Exception ("Invalid Username " );
347
347
}
348
348
$ search = $ this ->searchUser ($ username );
349
- if ($ search !== false && !empty ($ search ->user_list )) {
350
- $ result = Util::find ($ search ->user_list , function ($ item ) use ($ username ) {
349
+ if ($ search !== false && !empty ($ search ->data ) && isset ( $ search -> data [ 0 ]-> user_list )) {
350
+ $ result = Util::find ($ search ->data [ 0 ]-> user_list , function ($ item ) use ($ username ) {
351
351
return $ item ->user_info ->unique_id === $ username ;
352
352
});
353
353
if ($ result ) {
@@ -591,7 +591,7 @@ public function searchUser($keyword, $cursor = 0)
591
591
$ result = $ this ->remote_call ("search/user/ " . $ keyword , [
592
592
'maxCursor ' => $ cursor ,
593
593
]);
594
- if (isset ($ result ->user_list )) {
594
+ if (isset ($ result ->data [ 0 ]-> user_list )) {
595
595
if ($ this ->cacheEnabled ) {
596
596
$ this ->cacheEngine ->set ($ cacheKey , $ result , $ this ->_config ['cache_timeout ' ]);
597
597
}
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " tiktok-private-api" ,
3
- "version" : " 1.0.6 " ,
3
+ "version" : " 1.0.7 " ,
4
4
"description" : " Unofficial TikTok APP API for PHP" ,
5
5
"main" : " index.js" ,
6
6
"directories" : {
You can’t perform that action at this time.
0 commit comments