diff --git a/app/Controllers/EmbedController.php b/app/Controllers/EmbedController.php index 50b394e..48e4b73 100644 --- a/app/Controllers/EmbedController.php +++ b/app/Controllers/EmbedController.php @@ -11,8 +11,9 @@ class EmbedController { $video = $api->video($id); $video->feed(); if ($video->ok()) { - $data = $video->getFull(); - Wrappers::latte('video', new VideoTemplate($data->feed->items[0], $data->info->detail, true)); + $item = $video->getFeed()->items[0]; + $info = $video->getInfo(); + Wrappers::latte('video', new VideoTemplate($item, $info, true)); } else { ErrorHandler::showMeta($video->error()); } diff --git a/app/Controllers/MusicController.php b/app/Controllers/MusicController.php index 4d79eba..0ca11fe 100644 --- a/app/Controllers/MusicController.php +++ b/app/Controllers/MusicController.php @@ -14,8 +14,9 @@ class MusicController { $music = $api->music($music_id); $music->feed($cursor); if ($music->ok()) { - $data = $music->getFull(); - Wrappers::latte('music', new FullTemplate('Music', $data)); + $info = $music->getInfo(); + $feed = $music->getFeed(); + Wrappers::latte('music', new FullTemplate('Music', $info, $feed)); } else { ErrorHandler::showMeta($music->error()); } diff --git a/app/Controllers/ProxyController.php b/app/Controllers/ProxyController.php index 5f0a592..7121fb7 100644 --- a/app/Controllers/ProxyController.php +++ b/app/Controllers/ProxyController.php @@ -2,7 +2,6 @@ namespace App\Controllers; use App\Helpers\Cookies; -use TikScraper\Helpers\Converter; class ProxyController { const VALID_TIKTOK_DOMAINS = [ diff --git a/app/Controllers/TagController.php b/app/Controllers/TagController.php index bf6e808..a59e061 100644 --- a/app/Controllers/TagController.php +++ b/app/Controllers/TagController.php @@ -15,8 +15,9 @@ class TagController { $hashtag = $api->hashtag($name); $hashtag->feed($cursor); if ($hashtag->ok()) { - $data = $hashtag->getFull(); - Wrappers::latte('tag', new FullTemplate($data->info->detail->title, $data)); + $info = $hashtag->getInfo(); + $feed = $hashtag->getFeed(); + Wrappers::latte('tag', new FullTemplate($info->detail->title, $info, $feed)); } else { ErrorHandler::showMeta($hashtag->error()); } diff --git a/app/Controllers/UserController.php b/app/Controllers/UserController.php index 3706b24..0d73d07 100644 --- a/app/Controllers/UserController.php +++ b/app/Controllers/UserController.php @@ -16,12 +16,13 @@ class UserController { $user = $api->user($username); $user->feed($cursor); if ($user->ok()) { - $data = $user->getFull(); - if ($data->info->detail->privateAccount) { + $info = $user->getInfo(); + $feed = $user->getFeed(); + if ($info->detail->privateAccount) { ErrorHandler::showText(401, "Private account detected! Not supported"); return; } - Wrappers::latte('user', new FullTemplate($data->info->detail->nickname, $data)); + Wrappers::latte('user', new FullTemplate($info->detail->nickname, $info, $feed)); } else { ErrorHandler::showMeta($user->error()); } @@ -32,8 +33,9 @@ class UserController { $video = $api->video($video_id); $video->feed(); if ($video->ok()) { - $data = $video->getFull(); - Wrappers::latte('video', new VideoTemplate($data->feed->items[0], $data->info->detail)); + $item = $video->getFeed()->items[0]; + $info = $video->getInfo(); + Wrappers::latte('video', new VideoTemplate($item, $info)); } else { ErrorHandler::showMeta($video->error()); } diff --git a/app/Models/FullTemplate.php b/app/Models/FullTemplate.php index 23c7888..4951373 100644 --- a/app/Models/FullTemplate.php +++ b/app/Models/FullTemplate.php @@ -1,16 +1,19 @@ data = $data; + $this->info = $info; + $this->feed = $feed; } } diff --git a/app/Models/VideoTemplate.php b/app/Models/VideoTemplate.php index eb09545..5d13900 100644 --- a/app/Models/VideoTemplate.php +++ b/app/Models/VideoTemplate.php @@ -1,18 +1,20 @@ item = $item; - $this->detail = $detail; + $this->info = $info; if ($isEmbed) { $this->layout = 'embed'; } else { diff --git a/composer.json b/composer.json index f58a2cb..38a9ed5 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "pablouser1/proxitok", "description": "An alternative frontend for TikTok", - "version": "2.4.3.3", + "version": "2.4.3.4", "license": "AGPL-3.0-or-later", "type": "project", "authors": [ diff --git a/composer.lock b/composer.lock index 360787e..c16d35d 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "8100904920dbc589a80f80dd56cd6faf", + "content-hash": "5ed78859acc6f451f60b75dca1887104", "packages": [ { "name": "bramus/router", @@ -263,16 +263,16 @@ }, { "name": "pablouser1/tikscraper", - "version": "v2.3.2.2", + "version": "v2.3.3.0", "source": { "type": "git", "url": "https://github.com/pablouser1/TikScraperPHP.git", - "reference": "2016443571f87265ca8e37897d88009affdcd0b6" + "reference": "2da42296d97138acb75df5a3b70e7fd0a24ec270" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/pablouser1/TikScraperPHP/zipball/2016443571f87265ca8e37897d88009affdcd0b6", - "reference": "2016443571f87265ca8e37897d88009affdcd0b6", + "url": "https://api.github.com/repos/pablouser1/TikScraperPHP/zipball/2da42296d97138acb75df5a3b70e7fd0a24ec270", + "reference": "2da42296d97138acb75df5a3b70e7fd0a24ec270", "shasum": "" }, "require": { @@ -305,9 +305,9 @@ "description": "Get data from TikTok API", "support": { "issues": "https://github.com/pablouser1/TikScraperPHP/issues", - "source": "https://github.com/pablouser1/TikScraperPHP/tree/v2.3.2.2" + "source": "https://github.com/pablouser1/TikScraperPHP/tree/v2.3.3.0" }, - "time": "2022-11-22T19:43:57+00:00" + "time": "2022-11-26T22:27:16+00:00" }, { "name": "php-webdriver/webdriver", diff --git a/templates/components/head.latte b/templates/components/head.latte index 87eefb9..5373dc8 100644 --- a/templates/components/head.latte +++ b/templates/components/head.latte @@ -6,10 +6,26 @@ + {if isset($og, $og_content, $og_url)} + + + + + + + + + {else} + + + + + + {/if} - - + + {if isset($has_rss)} {/if} diff --git a/templates/components/themes/card.latte b/templates/components/themes/card.latte index c317d19..157a122 100644 --- a/templates/components/themes/card.latte +++ b/templates/components/themes/card.latte @@ -2,7 +2,7 @@
- {foreach $data->feed->items as $item} + {foreach $feed->items as $item} {do $share_url = url_video_external($item->author->uniqueId, $item->id)}
{/foreach} - {if empty($data->feed->items)} + {if empty($feed->items)}

No items sent by TikTok!

{/if}
diff --git a/templates/components/themes/default.latte b/templates/components/themes/default.latte index 38cb04d..e4af7f0 100644 --- a/templates/components/themes/default.latte +++ b/templates/components/themes/default.latte @@ -1,5 +1,5 @@
- {foreach $data->feed->items as $item} + {foreach $feed->items as $item}

@@ -31,7 +31,7 @@

{/foreach} - {if empty($data->feed->items)} + {if empty($feed->items)}

No items sent by TikTok!

{/if} diff --git a/templates/views/tag.latte b/templates/views/tag.latte index 11c6bcc..3de0384 100644 --- a/templates/views/tag.latte +++ b/templates/views/tag.latte @@ -2,15 +2,19 @@ {var $has_rss = true} +{var $og = $info->meta->og} +{var $og_content = $info->detail->profileLarger} +{var $og_url = url_tag($info->detail->title)} + {block header} - {if $data->info->detail->profileLarger !== ''} + {if $info->detail->profileLarger !== ''}
- +
{/if} -

{$data->info->detail->title}

+

{$info->detail->title}

{include '../components/rss.latte'}

-

Videos: {number($data->info->stats->videoCount)} / Views: {number($data->info->stats->viewCount)}

+

Videos: {number($info->stats->videoCount)} / Views: {number($info->stats->viewCount)}

{/block} {block content} diff --git a/templates/views/user.latte b/templates/views/user.latte index b6b873b..8a950a6 100644 --- a/templates/views/user.latte +++ b/templates/views/user.latte @@ -2,15 +2,19 @@ {var $has_rss = true} +{var $og = $info->meta->og} +{var $og_content = $info->detail->avatarLarger} +{var $og_url = url_user($info->detail->uniqueId)} + {block header}
- +
-

{$data->info->detail->uniqueId}

+

{$info->detail->uniqueId}

{include '../components/rss.latte'}

-

{$data->info->detail->signature}

-

Following: {number($data->info->stats->followingCount)} / Followers: {number($data->info->stats->followerCount)}

-

Hearts: {number($data->info->stats->heartCount)} / Videos: {$data->info->stats->videoCount}

+

{$info->detail->signature}

+

Following: {number($info->stats->followingCount)} / Followers: {number($info->stats->followerCount)}

+

Hearts: {number($info->stats->heartCount)} / Videos: {$info->stats->videoCount}

{/block} {block content} diff --git a/templates/views/video.latte b/templates/views/video.latte index da6a80c..0c6aa53 100644 --- a/templates/views/video.latte +++ b/templates/views/video.latte @@ -1,5 +1,9 @@ {layout "../layouts/{$layout}.latte"} +{var $og = $info->meta->og} +{var $og_content = $item->video->originCover} +{var $og_url = url_video_internal($info->detail->uniqueId, $item->id)} + {block content}
@@ -12,14 +16,14 @@

- +

- {$detail->nickname} + {$info->detail->nickname} - @{$detail->uniqueId} + @{$info->detail->uniqueId} {date('M d, Y', $item->createTime)}

@@ -30,8 +34,8 @@

{$item->desc}

{include '../components/themes/common/stats.latte', playCount: $item->stats->playCount, diggCount: $item->stats->diggCount, commentCount: $item->stats->commentCount, shareCount: $item->stats->shareCount}
- {include '../components/themes/common/share.latte', uniqueId: $detail->uniqueId, id: $item->id} - {include '../components/themes/common/download.latte', playAddr: $item->video->playAddr, id: $item->id, uniqueId: $detail->uniqueId} + {include '../components/themes/common/share.latte', uniqueId: $info->detail->uniqueId, id: $item->id} + {include '../components/themes/common/download.latte', playAddr: $item->video->playAddr, id: $item->id, uniqueId: $info->detail->uniqueId}