Revert "Added better og support"

This reverts commit fa3f1e0a7c.
This commit is contained in:
Pablo Ferreiro 2022-11-26 23:36:20 +01:00
parent fa3f1e0a7c
commit ee6e8b0593
No known key found for this signature in database
GPG key ID: 41FBCE65B779FA24
15 changed files with 47 additions and 84 deletions

View file

@ -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());
}

View file

@ -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());
}

View file

@ -2,6 +2,7 @@
namespace App\Controllers;
use App\Helpers\Cookies;
use TikScraper\Helpers\Converter;
class ProxyController {
const VALID_TIKTOK_DOMAINS = [

View file

@ -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());
}

View file

@ -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());
}

View file

@ -1,19 +1,16 @@
<?php
namespace App\Models;
use TikScraper\Models\Feed;
use TikScraper\Models\Info;
use TikScraper\Models\Full;
/**
* Base for templates with both info and feed
*/
class FullTemplate extends BaseTemplate {
public Info $info;
public Feed $feed;
public Full $data;
function __construct(string $title, Info $info, Feed $feed) {
function __construct(string $title, Full $data) {
parent::__construct($title);
$this->info = $info;
$this->feed = $feed;
$this->data = $data;
}
}

View file

@ -1,20 +1,18 @@
<?php
namespace App\Models;
use TikScraper\Models\Info;
/**
* Base for templates with a feed
*/
class VideoTemplate extends BaseTemplate {
public object $item;
public Info $info;
public object $detail;
public string $layout = 'hero';
function __construct(object $item, Info $info, bool $isEmbed = false) {
function __construct(object $item, object $detail, bool $isEmbed = false) {
parent::__construct('Video');
$this->item = $item;
$this->info = $info;
$this->detail = $detail;
if ($isEmbed) {
$this->layout = 'embed';
} else {