proxitok/app/Controllers/TrendingController.php

38 lines
1,019 B
PHP
Raw Permalink 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 {
2023-04-27 14:23:23 -04:00
public static 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) {
2022-11-04 15:08:19 -04:00
Wrappers::latte('trending', new FeedTemplate('Trending', $feed));
2022-01-30 18:02:52 -05:00
} else {
2022-09-03 08:01:03 -04:00
ErrorHandler::showMeta($trending->error());
2022-01-30 18:02:52 -05:00
}
}
2023-04-27 14:23:23 -04:00
public static 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) {
2022-11-04 15:08:19 -04:00
Misc::rss('Trending');
Wrappers::latte('rss', new RSSTemplate('Trending', 'Trending on TikTok', Misc::url('/trending'), $feed->items));
2022-01-30 18:02:52 -05:00
}
}
}