Auto patch API

This commit is contained in:
Pablo Ferreiro 2022-01-04 00:18:13 +01:00
parent c700036aa2
commit c8d6516dd7
No known key found for this signature in database
GPG key ID: 41FBCE65B779FA24
8 changed files with 23 additions and 9 deletions

1
.gitignore vendored
View file

@ -3,3 +3,4 @@
/vendor
/cache/views/*
!/cache/views/.gitkeep
/.new_api

View file

@ -37,7 +37,7 @@ location /tiktok-viewer/.env {
```
## Known issues
* Right now there is an error when trying to fetch the desired user, there is already a pull request not merged yet fixing this issue on the TikTokApi repo, you can check it out [here](https://github.com/ssovit/TikTok-API-PHP/pull/43)
* Right now there is an error when trying to fetch the desired user, there is already a pull request not merged yet fixing this issue on the TikTokApi repo, you can check it out [here](https://github.com/ssovit/TikTok-API-PHP/pull/43). **This is automatically patched after running composer install**
## TODO
* Allow searching for just one video using the ID

View file

@ -10,5 +10,10 @@
"steampixel/simple-php-router": "^0.7.0",
"latte/latte": "^2.10",
"vlucas/phpdotenv": "^5.4"
},
"scripts": {
"post-install-cmd": [
"php fix_api.php"
]
}
}

7
fix_api.php Normal file
View file

@ -0,0 +1,7 @@
<?php
if (!file_exists(__DIR__ . '/.new_api')) {
$new_api = file_get_contents('https://raw.githubusercontent.com/attend-dunce/TikTok-API-PHP/master/lib/TikTok/Api.php');
file_put_contents(__DIR__ . '/vendor/ssovit/tiktok-api/lib/TikTok/Api.php', $new_api);
file_put_contents(__DIR__ . '/.new_api', 'DO NOT DELETE! This file proves that you have patched the API');
echo('Patched API!');
}

View file

@ -11,6 +11,7 @@ $domains = [
"v16-webapp.tiktok.com"
],
"audio" => [
"sf16-ies-music-va.tiktokcdn.com"
"sf16-ies-music-va.tiktokcdn.com",
"sf77-ies-music-va.tiktokcdn.com"
],
];

View file

@ -3,10 +3,8 @@ require __DIR__ . "/vendor/autoload.php";
use Steampixel\Route;
// LOAD DOTENV
if (file_exists(__DIR__ . '/.env')) {
$dotenv = Dotenv\Dotenv::createImmutable(__DIR__);
$dotenv->load();
}
$dotenv = Dotenv\Dotenv::createImmutable(__DIR__);
$dotenv->safeLoad();
// -- HELPERS -- //
function getSubdir(): string {

View file

@ -1,7 +1,7 @@
<footer class="footer">
<div class="content">
<p class="has-text-centered">
Made with <span style="color: #e25555;">&#9829;</span> in <a href="https://github.com/pablouser1/tiktok-viewer">Github</a>
Made with <span style="color: #e25555;">&#9829;</span> in <a href="https://github.com/pablouser1/tiktok-alt-frontend">Github</a>
</p>
</div>
</footer>

View file

@ -4,8 +4,10 @@
{include 'components/head.latte', title: 'Home'}
<body>
{include 'components/navbar.latte'}
<section class="hero is-fullheight-with-navbar">
<section class="hero is-fullheight">
<div class="hero-head">
{include 'components/navbar.latte'}
</div>
<div class="hero-body">
<div class="container has-text-centered">
<p class="title">Welcome to TikTok Alt-Frontend!</p>