proxitok/app/Controllers/TrendingController.php

39 lines
1.1 KiB
PHP
Raw Normal View History

2022-01-30 18:02:52 -05:00
<?php
namespace App\Controllers;
use App\Helpers\Misc;
use App\Models\FeedTemplate;
use App\Helpers\ErrorHandler;
use App\Helpers\Wrappers;
use App\Models\RSSTemplate;
2022-01-30 18:02:52 -05:00
class TrendingController {
static public function get() {
$api = Wrappers::api();
2022-06-04 15:04:43 -04:00
$cursor = Misc::getTtwid();
2022-05-24 08:10:41 -04:00
$trending = $api->trending();
$trending->feed($cursor);
$feed = $trending->getFeed();
if ($feed && $feed->meta->success) {
$latte = Wrappers::latte();
2022-01-30 18:02:52 -05:00
$latte->render(Misc::getView('trending'), new FeedTemplate('Trending', $feed));
} else {
2022-09-03 08:01:03 -04:00
ErrorHandler::showMeta($trending->error());
2022-01-30 18:02:52 -05:00
}
}
static public function rss() {
$api = Wrappers::api();
2022-05-24 08:10:41 -04:00
$trending = $api->trending();
$trending->feed();
$feed = $trending->getFeed();
if ($feed && $feed->meta->success) {
$latte = Wrappers::latte();
$latte->render(Misc::getView('rss'), new RSSTemplate('Trending', 'Trending on TikTok', '/trending', $feed->items));
2022-01-30 18:02:52 -05:00
}
}
}