Fixed trending, added explanation on VERIFY_CODE
This commit is contained in:
parent
1e1376506c
commit
f1de8e979b
|
@ -9,9 +9,15 @@ use App\Helpers\RSS;
|
||||||
class TrendingController {
|
class TrendingController {
|
||||||
static public function get() {
|
static public function get() {
|
||||||
$cursor = Misc::getTtwid();
|
$cursor = Misc::getTtwid();
|
||||||
$page = $_GET['page'] ?? 0;
|
|
||||||
$api = Misc::api();
|
$api = Misc::api();
|
||||||
$feed = $api->getTrending($cursor, $page);
|
|
||||||
|
// Ttwid if normal, cursor if legacy
|
||||||
|
if ($api::class === 'TikScraper\Api') {
|
||||||
|
$cursor = Misc::getTtwid();
|
||||||
|
} else {
|
||||||
|
$cursor = Misc::getCursor();
|
||||||
|
}
|
||||||
|
$feed = $api->getTrending($cursor);
|
||||||
if ($feed->meta->success) {
|
if ($feed->meta->success) {
|
||||||
$latte = Misc::latte();
|
$latte = Misc::latte();
|
||||||
$latte->render(Misc::getView('trending'), new FeedTemplate('Trending', $feed));
|
$latte->render(Misc::getView('trending'), new FeedTemplate('Trending', $feed));
|
||||||
|
|
12
composer.lock
generated
12
composer.lock
generated
|
@ -306,16 +306,16 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "pablouser1/tikscraper",
|
"name": "pablouser1/tikscraper",
|
||||||
"version": "v1.2.7.3",
|
"version": "v1.2.7.4",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/pablouser1/TikScraperPHP.git",
|
"url": "https://github.com/pablouser1/TikScraperPHP.git",
|
||||||
"reference": "64385d72ab47d14f883b24a40268ea4e7542133c"
|
"reference": "f42df2e947cfe9afc31a46737a48e720f161ef1c"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/pablouser1/TikScraperPHP/zipball/64385d72ab47d14f883b24a40268ea4e7542133c",
|
"url": "https://api.github.com/repos/pablouser1/TikScraperPHP/zipball/f42df2e947cfe9afc31a46737a48e720f161ef1c",
|
||||||
"reference": "64385d72ab47d14f883b24a40268ea4e7542133c",
|
"reference": "f42df2e947cfe9afc31a46737a48e720f161ef1c",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
|
@ -339,9 +339,9 @@
|
||||||
"description": "Get data from TikTok API",
|
"description": "Get data from TikTok API",
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/pablouser1/TikScraperPHP/issues",
|
"issues": "https://github.com/pablouser1/TikScraperPHP/issues",
|
||||||
"source": "https://github.com/pablouser1/TikScraperPHP/tree/v1.2.7.3"
|
"source": "https://github.com/pablouser1/TikScraperPHP/tree/v1.2.7.4"
|
||||||
},
|
},
|
||||||
"time": "2022-03-11T20:01:55+00:00"
|
"time": "2022-03-11T21:42:09+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "phpoption/phpoption",
|
"name": "phpoption/phpoption",
|
||||||
|
|
|
@ -14,6 +14,11 @@ $router->get('/about', function () {
|
||||||
$latte->render(Misc::getView('about'), new BaseTemplate('About'));
|
$latte->render(Misc::getView('about'), new BaseTemplate('About'));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$router->get('/verify', function () {
|
||||||
|
$latte = Misc::latte();
|
||||||
|
$latte->render(Misc::getView('verify'), new BaseTemplate('Verify'));
|
||||||
|
});
|
||||||
|
|
||||||
$router->get('/stream', 'ProxyController@stream');
|
$router->get('/stream', 'ProxyController@stream');
|
||||||
$router->get('/download', 'ProxyController@download');
|
$router->get('/download', 'ProxyController@download');
|
||||||
$router->get('/redirect', 'RedirectController@redirect');
|
$router->get('/redirect', 'RedirectController@redirect');
|
||||||
|
|
|
@ -6,7 +6,11 @@
|
||||||
{/block}
|
{/block}
|
||||||
|
|
||||||
{block content}
|
{block content}
|
||||||
<p class="title">Why?</p>
|
<p class="title">About this instance</p>
|
||||||
|
<p>Forcing Legacy mode: {isset($_ENV['FORCE_LEGACY']) ? 'yes' : 'no'}</p>
|
||||||
|
<p>Instance-level Proxy: {isset($_ENV['PROXY_HOST']) ? 'yes' : 'no'}</p>
|
||||||
|
<hr />
|
||||||
|
<p class="title">Why would I want to use ProxiTok?</p>
|
||||||
<p>
|
<p>
|
||||||
There are already
|
There are already
|
||||||
<a rel="nofollow" href="https://penetrum.com/tiktok/Penetrum_TikTok_Security_Analysis_whitepaper.pdf">multiple</a>
|
<a rel="nofollow" href="https://penetrum.com/tiktok/Penetrum_TikTok_Security_Analysis_whitepaper.pdf">multiple</a>
|
||||||
|
|
|
@ -5,5 +5,8 @@
|
||||||
<p class="subtitle">HTTP Code: {$error->http_code}</p>
|
<p class="subtitle">HTTP Code: {$error->http_code}</p>
|
||||||
{if $error->tiktok_code}
|
{if $error->tiktok_code}
|
||||||
<p class="subtitle">API error code {$error->tiktok_code} ({$error->tiktok_msg})</p>
|
<p class="subtitle">API error code {$error->tiktok_code} ({$error->tiktok_msg})</p>
|
||||||
|
{if $error->tiktok_code === 10000}
|
||||||
|
<a href="{path('/verify')}">What does this mean?</a>
|
||||||
|
{/if}
|
||||||
{/if}
|
{/if}
|
||||||
{/block}
|
{/block}
|
||||||
|
|
38
views/verify.latte
Normal file
38
views/verify.latte
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
{layout '../layouts/default.latte'}
|
||||||
|
|
||||||
|
{block header}
|
||||||
|
<p class="title">VERIFY_CODE</p>
|
||||||
|
<p class="subtitle">What can I do?</p>
|
||||||
|
{/block}
|
||||||
|
|
||||||
|
{block content}
|
||||||
|
<p>TL;DR You probably have to search for another instance or wait some hours (or even better, have your own self-hosted instance)</p>
|
||||||
|
<p>TikTok has some mecanisms in order to stop scraping on their latest api (/api/...):</p>
|
||||||
|
<hr />
|
||||||
|
<div class="block">
|
||||||
|
<p class="is-size-4">Rate limits</p>
|
||||||
|
<p>
|
||||||
|
This is pretty standard stuff,
|
||||||
|
it blocks ips temporarly if you send too many requests to an endpoint and unbans you after some hours.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div class="block">
|
||||||
|
<p class="is-size-4">IP Blacklist</p>
|
||||||
|
<p>
|
||||||
|
It is a list with IPs from popular Hosters (AWS, Heroku...). This IPs are banned <i>(I think) permanently</i> and
|
||||||
|
can barely make requests.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
This makes hosting a public instance really hard. Even if you use a hosting platform that is not banned by TikTok, it is only a matter of time
|
||||||
|
that it inevitably gets banned.
|
||||||
|
</p>
|
||||||
|
<p class="is-size-5">(For webmasters) How can I know if my server is not blacklisted?</p>
|
||||||
|
<p>Run this command on your instance:</p>
|
||||||
|
<code>
|
||||||
|
curl \
|
||||||
|
--url 'https://www.tiktok.com/@tiktok/?lang=en' \
|
||||||
|
--header 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Safari/537.36'
|
||||||
|
</code>
|
||||||
|
<p>If you don't get an empty response or a captcha, you are good to go</p>
|
||||||
|
</div>
|
||||||
|
{/block}
|
Loading…
Reference in a new issue