proxitok/app/Helpers/UrlBuilder.php

28 lines
1,009 B
PHP
Raw Normal View History

2022-09-25 13:53:00 -04:00
<?php
namespace App\Helpers;
class UrlBuilder {
static public function stream(string $url): string {
return Misc::url('/stream?url=' . urlencode($url));
}
2022-10-24 14:53:59 -04:00
static public function download(string $url, string $username, string $id, bool $watermark): string {
2022-09-25 13:53:00 -04:00
// {path('/download?url=' . urlencode($playAddr) . '&id=' . $id . '&user=' . $uniqueId) . '&watermark=1'}
2022-10-24 14:53:59 -04:00
$down_url = Misc::url('/download?url=' . urlencode($url) . '&id=' . $id . '&user=' . $username);
2022-09-25 13:53:00 -04:00
if ($watermark) $down_url .= '&watermark=1';
return $down_url;
}
static public function user(string $username): string {
return Misc::url('/@' . $username);
}
static public function video_internal(string $username, string $id): string {
return Misc::url('/@' . $username . "/video/" . $id);
}
static public function video_external(string $username, string $id): string {
return "https://www.tiktok.com/@" . $username . "/video/" . $id;
}
}