From ee6e8b059394c9c9f7fa024f468ba741453522db Mon Sep 17 00:00:00 2001 From: Pablo Ferreiro Date: Sat, 26 Nov 2022 23:36:20 +0100 Subject: [PATCH] Revert "Added better og support" This reverts commit fa3f1e0a7c5fad6898751af91fbe61e930584487. --- app/Controllers/EmbedController.php | 5 ++--- app/Controllers/MusicController.php | 5 ++--- app/Controllers/ProxyController.php | 1 + app/Controllers/TagController.php | 5 ++--- app/Controllers/UserController.php | 12 +++++------- app/Models/FullTemplate.php | 11 ++++------- app/Models/VideoTemplate.php | 8 +++----- composer.json | 2 +- composer.lock | 14 +++++++------- templates/components/head.latte | 20 ++------------------ templates/components/themes/card.latte | 4 ++-- templates/components/themes/default.latte | 4 ++-- templates/views/tag.latte | 12 ++++-------- templates/views/user.latte | 14 +++++--------- templates/views/video.latte | 14 +++++--------- 15 files changed, 47 insertions(+), 84 deletions(-) diff --git a/app/Controllers/EmbedController.php b/app/Controllers/EmbedController.php index 48e4b73..50b394e 100644 --- a/app/Controllers/EmbedController.php +++ b/app/Controllers/EmbedController.php @@ -11,9 +11,8 @@ class EmbedController { $video = $api->video($id); $video->feed(); if ($video->ok()) { - $item = $video->getFeed()->items[0]; - $info = $video->getInfo(); - Wrappers::latte('video', new VideoTemplate($item, $info, true)); + $data = $video->getFull(); + Wrappers::latte('video', new VideoTemplate($data->feed->items[0], $data->info->detail, true)); } else { ErrorHandler::showMeta($video->error()); } diff --git a/app/Controllers/MusicController.php b/app/Controllers/MusicController.php index 0ca11fe..4d79eba 100644 --- a/app/Controllers/MusicController.php +++ b/app/Controllers/MusicController.php @@ -14,9 +14,8 @@ class MusicController { $music = $api->music($music_id); $music->feed($cursor); if ($music->ok()) { - $info = $music->getInfo(); - $feed = $music->getFeed(); - Wrappers::latte('music', new FullTemplate('Music', $info, $feed)); + $data = $music->getFull(); + Wrappers::latte('music', new FullTemplate('Music', $data)); } else { ErrorHandler::showMeta($music->error()); } diff --git a/app/Controllers/ProxyController.php b/app/Controllers/ProxyController.php index 7121fb7..5f0a592 100644 --- a/app/Controllers/ProxyController.php +++ b/app/Controllers/ProxyController.php @@ -2,6 +2,7 @@ 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 a59e061..bf6e808 100644 --- a/app/Controllers/TagController.php +++ b/app/Controllers/TagController.php @@ -15,9 +15,8 @@ class TagController { $hashtag = $api->hashtag($name); $hashtag->feed($cursor); if ($hashtag->ok()) { - $info = $hashtag->getInfo(); - $feed = $hashtag->getFeed(); - Wrappers::latte('tag', new FullTemplate($info->detail->title, $info, $feed)); + $data = $hashtag->getFull(); + Wrappers::latte('tag', new FullTemplate($data->info->detail->title, $data)); } else { ErrorHandler::showMeta($hashtag->error()); } diff --git a/app/Controllers/UserController.php b/app/Controllers/UserController.php index 0d73d07..3706b24 100644 --- a/app/Controllers/UserController.php +++ b/app/Controllers/UserController.php @@ -16,13 +16,12 @@ class UserController { $user = $api->user($username); $user->feed($cursor); if ($user->ok()) { - $info = $user->getInfo(); - $feed = $user->getFeed(); - if ($info->detail->privateAccount) { + $data = $user->getFull(); + if ($data->info->detail->privateAccount) { ErrorHandler::showText(401, "Private account detected! Not supported"); return; } - Wrappers::latte('user', new FullTemplate($info->detail->nickname, $info, $feed)); + Wrappers::latte('user', new FullTemplate($data->info->detail->nickname, $data)); } else { ErrorHandler::showMeta($user->error()); } @@ -33,9 +32,8 @@ class UserController { $video = $api->video($video_id); $video->feed(); if ($video->ok()) { - $item = $video->getFeed()->items[0]; - $info = $video->getInfo(); - Wrappers::latte('video', new VideoTemplate($item, $info)); + $data = $video->getFull(); + Wrappers::latte('video', new VideoTemplate($data->feed->items[0], $data->info->detail)); } else { ErrorHandler::showMeta($video->error()); } diff --git a/app/Models/FullTemplate.php b/app/Models/FullTemplate.php index 4951373..23c7888 100644 --- a/app/Models/FullTemplate.php +++ b/app/Models/FullTemplate.php @@ -1,19 +1,16 @@ info = $info; - $this->feed = $feed; + $this->data = $data; } } diff --git a/app/Models/VideoTemplate.php b/app/Models/VideoTemplate.php index 5d13900..eb09545 100644 --- a/app/Models/VideoTemplate.php +++ b/app/Models/VideoTemplate.php @@ -1,20 +1,18 @@ item = $item; - $this->info = $info; + $this->detail = $detail; if ($isEmbed) { $this->layout = 'embed'; } else { diff --git a/composer.json b/composer.json index 38a9ed5..f58a2cb 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "pablouser1/proxitok", "description": "An alternative frontend for TikTok", - "version": "2.4.3.4", + "version": "2.4.3.3", "license": "AGPL-3.0-or-later", "type": "project", "authors": [ diff --git a/composer.lock b/composer.lock index c16d35d..360787e 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": "5ed78859acc6f451f60b75dca1887104", + "content-hash": "8100904920dbc589a80f80dd56cd6faf", "packages": [ { "name": "bramus/router", @@ -263,16 +263,16 @@ }, { "name": "pablouser1/tikscraper", - "version": "v2.3.3.0", + "version": "v2.3.2.2", "source": { "type": "git", "url": "https://github.com/pablouser1/TikScraperPHP.git", - "reference": "2da42296d97138acb75df5a3b70e7fd0a24ec270" + "reference": "2016443571f87265ca8e37897d88009affdcd0b6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/pablouser1/TikScraperPHP/zipball/2da42296d97138acb75df5a3b70e7fd0a24ec270", - "reference": "2da42296d97138acb75df5a3b70e7fd0a24ec270", + "url": "https://api.github.com/repos/pablouser1/TikScraperPHP/zipball/2016443571f87265ca8e37897d88009affdcd0b6", + "reference": "2016443571f87265ca8e37897d88009affdcd0b6", "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.3.0" + "source": "https://github.com/pablouser1/TikScraperPHP/tree/v2.3.2.2" }, - "time": "2022-11-26T22:27:16+00:00" + "time": "2022-11-22T19:43:57+00:00" }, { "name": "php-webdriver/webdriver", diff --git a/templates/components/head.latte b/templates/components/head.latte index 5373dc8..87eefb9 100644 --- a/templates/components/head.latte +++ b/templates/components/head.latte @@ -6,26 +6,10 @@ - {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 157a122..c317d19 100644 --- a/templates/components/themes/card.latte +++ b/templates/components/themes/card.latte @@ -2,7 +2,7 @@
- {foreach $feed->items as $item} + {foreach $data->feed->items as $item} {do $share_url = url_video_external($item->author->uniqueId, $item->id)}
{/foreach} - {if empty($feed->items)} + {if empty($data->feed->items)}

No items sent by TikTok!

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

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

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

No items sent by TikTok!

{/if} diff --git a/templates/views/tag.latte b/templates/views/tag.latte index 3de0384..11c6bcc 100644 --- a/templates/views/tag.latte +++ b/templates/views/tag.latte @@ -2,19 +2,15 @@ {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 $info->detail->profileLarger !== ''} + {if $data->info->detail->profileLarger !== ''}
- +
{/if} -

{$info->detail->title}

+

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

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

-

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

+

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

{/block} {block content} diff --git a/templates/views/user.latte b/templates/views/user.latte index 8a950a6..b6b873b 100644 --- a/templates/views/user.latte +++ b/templates/views/user.latte @@ -2,19 +2,15 @@ {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}
- +
-

{$info->detail->uniqueId}

+

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

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

-

{$info->detail->signature}

-

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

-

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

+

{$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}

{/block} {block content} diff --git a/templates/views/video.latte b/templates/views/video.latte index 0c6aa53..da6a80c 100644 --- a/templates/views/video.latte +++ b/templates/views/video.latte @@ -1,9 +1,5 @@ {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}
@@ -16,14 +12,14 @@

- +

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

@@ -34,8 +30,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: $info->detail->uniqueId, id: $item->id} - {include '../components/themes/common/download.latte', playAddr: $item->video->playAddr, id: $item->id, uniqueId: $info->detail->uniqueId} + {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}