proxitok/app/Helpers/UrlBuilder.php

31 lines
998 B
PHP
Raw Permalink Normal View History

2022-09-25 13:53:00 -04:00
<?php
namespace App\Helpers;
class UrlBuilder {
2023-04-27 14:23:23 -04:00
public static function stream(string $url): string {
2022-09-25 13:53:00 -04:00
return Misc::url('/stream?url=' . urlencode($url));
}
2023-04-27 14:23:23 -04:00
public static function download(string $url, string $username, string $id, bool $watermark): string {
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;
}
2023-04-27 14:23:23 -04:00
public static function user(string $username): string {
2022-09-25 13:53:00 -04:00
return Misc::url('/@' . $username);
}
2023-04-27 14:23:23 -04:00
public static function tag(string $tag): string {
2022-11-04 15:08:19 -04:00
return Misc::url('/tag/' . $tag);
}
2023-04-27 14:23:23 -04:00
public static function video_internal(string $username, string $id): string {
2022-09-25 13:53:00 -04:00
return Misc::url('/@' . $username . "/video/" . $id);
}
2023-04-27 14:23:23 -04:00
public static function video_external(string $username, string $id): string {
2022-09-25 13:53:00 -04:00
return "https://www.tiktok.com/@" . $username . "/video/" . $id;
}
}