diff --git a/README.md b/README.md index 083b23b..a2d9ee8 100644 --- a/README.md +++ b/README.md @@ -12,8 +12,7 @@ php -S localhost:8080 ``` ## Known issues -* Right now there is an error when trying to fetch the desired user, there is already a pull request fixing this issue on the TikTokApi repo, you can check it out [here](https://github.com/ssovit/TikTok-API-PHP/pull/43) -* Only one page is available to the user +* Right now there is an error when trying to fetch the desired user, there is already a pull request not merged yet fixing this issue on the TikTokApi repo, you can check it out [here](https://github.com/ssovit/TikTok-API-PHP/pull/43) ## Credits * [TikTok-API-PHP](https://github.com/ssovit/TikTok-API-PHP) diff --git a/index.php b/index.php index 3df3f10..9cdf157 100644 --- a/index.php +++ b/index.php @@ -10,9 +10,13 @@ $app->get('/', function () use ($app) { }); $app->get("/users/{user}", function (string $username) { + $cursor = 0; + if (isset($_GET['cursor']) && is_numeric($_GET['cursor'])) { + $cursor = (int) $_GET['cursor']; + } $blade = new Blade('./views', './cache/views'); $api = new \Sovit\TikTok\Api(); - $user = $api->getUserFeed($username); + $user = $api->getUserFeed($username, $cursor); if ($user) { echo $blade->render('user', ['user' => $user]); } else { diff --git a/views/user.blade.php b/views/user.blade.php index 8f2e9b5..5f00c9a 100644 --- a/views/user.blade.php +++ b/views/user.blade.php @@ -34,6 +34,14 @@ @endforeach +
+ Last page + @if ($user->hasMore) + Next page + @else + Next page + @endif +