Compare commits

...

3 Commits

Author SHA1 Message Date
Pablo Ferreiro 2c73bd0388 Allow download without watermark 2022-02-07 21:07:51 +01:00
Pablo Ferreiro dd5964cb97 Fixed /video and set user on video download 2022-02-07 18:40:32 +01:00
Pablo Ferreiro 19553f8837 Workaround for back btn. Added id to vid download 2022-02-07 18:32:45 +01:00
7 changed files with 42 additions and 23 deletions
+1 -1
View File
@@ -20,6 +20,6 @@ jobs:
- name: Create Release
uses: ncipollo/release-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag: v${{steps.version.outputs.prop}}
token: ${{ secrets.GITHUB_TOKEN }}
allowUpdates: true
+14 -2
View File
@@ -9,7 +9,14 @@ class ProxyController {
static private function isValidDomain(string $url) {
$host = parse_url($url, PHP_URL_HOST);
$host_split = explode('.', $host);
return count($host_split) === 3 && in_array($host_split[1] . '.' . $host_split[2], self::VALID_TIKTOK_DOMAINS);
$host_count = count($host_split);
if ($host_count === 2) {
// Using no watermark
return in_array($host_split[0] . '.' . $host_split[1], self::VALID_TIKTOK_DOMAINS);
} elseif ($host_count === 3) {
return in_array($host_split[1] . '.' . $host_split[2], self::VALID_TIKTOK_DOMAINS);
}
return false;
}
static public function stream() {
@@ -25,7 +32,12 @@ class ProxyController {
if (isset($_GET['download'])) {
// Download
$downloader = new \Sovit\TikTok\Download();
$downloader->url($url, "tiktok-video", 'mp4');
$filename = 'tiktok-video';
if (isset($_GET['id'], $_GET['user'])) {
$filename .= '-' . $_GET['user'] . '-' . $_GET['id'];
}
$watermark = isset($_GET['watermark']);
$downloader->url($url, $filename, $watermark);
} else {
// Stream
$streamer = new \Sovit\TikTok\Stream();
+11 -6
View File
@@ -6,7 +6,8 @@
<div class="column is-one-quarter">
<a class="clickable-img" id="{$item->id}" href="#{$item->id}"
data-video_url="{path('/stream?url=' . urlencode($item->video->playAddr))}"
data-video_download="{path('/stream?url=' . urlencode($item->video->playAddr) . '&download=1')}"
data-video_download_watermark="{path('/stream?url=' . urlencode($item->video->playAddr) . '&download=1&id=' . $item->id . '&user=' . $item->author->uniqueId) . '&watermark='}"
data-video_download_nowatermark="{path('/stream?url=' . urlencode('https://tiktok.com/@' . $item->author->uniqueId . '/' . $item->id) . '&download=1&id=' . $item->id . '&user=' . $item->author->uniqueId)}"
data-desc="{$item->desc}"
data-music_title="{$item->music->title}"
data-music_url="{path('/stream?url=' . urlencode($item->music->playUrl))}">
@@ -17,11 +18,11 @@
{/foreach}
</div>
<div n:ifset="$feed->info" class="buttons">
{if isset($_GET['cursor']) && $_GET['cursor'] != 0}
<a class="button is-danger" href="?cursor=0">First</a>
<a class="button is-danger" href="?cursor={$feed->minCursor}">Back</a>
{if isset($_GET['cursor']) && $_GET['cursor'] != 0 }
<a class="button is-danger" href="?">First</a>
<button class="button is-danger" onclick="history.back()">Back</button>
{/if}
<a n:attr="disabled => $feed->hasMore" class="button is-success" href="?cursor={$feed->maxCursor}">Next</a>
<a n:attr="disabled => !$feed->hasMore" class="button is-success" href="?cursor={$feed->maxCursor}">Next</a>
</div>
</section>
@@ -38,7 +39,11 @@
</section>
<footer class="modal-card-foot has-text-centered">
<div class="container">
<a id="download_button" target="_blank" class="button is-info" download>Download</a>
<div class="buttons is-centered">
<a target="_blank" id="download_watermark" class="button is-info" download>Download with watermark</a>
<a target="_blank" id="download_nowatermark" class="button is-info">Download without watermark</a>
</div>
<p>Please be patient with the No Watermark option. It takes a while to download</p>
<p id="audio_title"></p>
<audio id="audio" controls preload="none"></audio>
<div class="buttons is-centered">
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "pablouser1/proxitok",
"description": "An alternative frontend for TikTok",
"version": "1.4.1",
"version": "1.4.1.3",
"license": "AGPL-3.0-or-later",
"type": "project",
"homepage": "https://github.com/pablouser1/ProxiTok",
Generated
+5 -5
View File
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "b40da817e3b81d14a1ed55aad52cf434",
"content-hash": "94d34d2f322b7dfcf36f55780c95cd59",
"packages": [
{
"name": "bramus/router",
@@ -381,12 +381,12 @@
"source": {
"type": "git",
"url": "https://github.com/pablouser1/TikTok-API-PHP.git",
"reference": "c6667d70757fd5405ee1b51eaa6602d8758d2abd"
"reference": "6d2be1b886e455d6e124453dff07de3e89c0d45a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/pablouser1/TikTok-API-PHP/zipball/c6667d70757fd5405ee1b51eaa6602d8758d2abd",
"reference": "c6667d70757fd5405ee1b51eaa6602d8758d2abd",
"url": "https://api.github.com/repos/pablouser1/TikTok-API-PHP/zipball/6d2be1b886e455d6e124453dff07de3e89c0d45a",
"reference": "6d2be1b886e455d6e124453dff07de3e89c0d45a",
"shasum": ""
},
"type": "library",
@@ -425,7 +425,7 @@
"issues": "https://github.com/ssovit/TikTok-API-PHP/issues",
"email": "sovit.tamrakar@gmail.com"
},
"time": "2022-02-06T13:17:16+00:00"
"time": "2022-02-07T20:07:07+00:00"
},
{
"name": "symfony/polyfill-ctype",
+5 -3
View File
@@ -3,7 +3,8 @@ const item_title = document.getElementById('item_title')
const audio = document.getElementById('audio')
const audio_title = document.getElementById('audio_title')
const modal = document.getElementById('modal')
const download_button = document.getElementById('download_button')
const download_watermark = document.getElementById('download_watermark')
const download_nowatermark = document.getElementById('download_nowatermark')
// -- HELPERS -- //
const getHash = () => window.location.hash.substring(1)
@@ -21,10 +22,11 @@ const isModalActive = () => modal.classList.contains('is-active')
const toggleButton = (id, force) => document.getElementById(id) ? document.getElementById(id).toggleAttribute('disabled', force) : alert('That button does not exist')
// -- MODAL -- //
const swapData = ({ video_url, desc, video_download, music_title, music_url }) => {
const swapData = ({ video_url, desc, video_download_watermark, video_download_nowatermark, music_title, music_url }) => {
video.src = video_url
item_title.innerText = desc
download_button.href = video_download
download_watermark.href = video_download_watermark
download_nowatermark.href = video_download_nowatermark
audio_title.innerText = music_title
audio.src = music_url
}
+5 -5
View File
@@ -3,20 +3,20 @@
{block content}
<div class="columns is-centered is-vcentered">
<div class="column">
<video controls poster="{path('stream?url=' . urlencode($item->items[0]->video->originCover))}">
<source src="{path('stream?url=' . urlencode($item->items[0]->video->playAddr))}" type="video/mp4" />
<video controls poster="{path('/stream?url=' . urlencode($item->items[0]->video->originCover))}">
<source src="{path('/stream?url=' . urlencode($item->items[0]->video->playAddr))}" type="video/mp4" />
</video>
</div>
<div class="column has-text-centered">
<div class="box">
<p class="title">Video by <a href="{path('@'.$item->info->detail->user->uniqueId)}">{$item->info->detail->user->uniqueId}</a></p>
<p class="title">Video by <a href="{path('/@'.$item->info->detail->user->uniqueId)}">{$item->info->detail->user->uniqueId}</a></p>
<p class="subtitle">{$item->items[0]->desc}</p>
<p>Played {number($item->info->detail->stats->playCount)} times</p>
<p>Shared {number($item->info->detail->stats->shareCount)} times / {number($item->info->detail->stats->commentCount)} comments</p>
<hr />
<a href="{path('stream?url=' . urlencode($item->items[0]->video->playAddr) . '&download=1')}" class="button is-info">Download video</a>
<a href="{path('/stream?url=' . urlencode($item->items[0]->video->playAddr) . '&download=1')}" class="button is-info">Download video</a>
<p>{$item->items[0]->music->title}</p>
<audio src="{path('stream?url=' . urlencode($item->items[0]->music->playUrl))}" controls preload="none"></audio>
<audio src="{path('/stream?url=' . urlencode($item->items[0]->music->playUrl))}" controls preload="none"></audio>
</div>
</div>
</div>