This commit is contained in:
ge
2023-02-19 01:32:35 +03:00
commit e80a3b1916
20 changed files with 2542 additions and 0 deletions

View File

@ -0,0 +1,41 @@
% include('templates/header.tpl', title='Running downloads')
% if job:
<div class="container mx-auto p-4 pt-0 mt-0">
<div class="w-fit bg-green-100 rounded-md px-8 py-4">
Download started.
</div>
</div>
% end
% if downloads:
<div class="container mx-auto p-4 pt-0 m-4 mt-0">
<h1 class="text-3xl font-bold mb-4">Running tasks</h1>
<div class="w-fit bg-red-100 rounded-md px-8 py-4 mb-8">
Refresh this page to view actual data.
<a href="/downloads">
<button class="bg-red-600 hover:bg-red-500 p-2 mx-2 text-white font-bold rounded-md">
Refresh
</button>
</a>
</div>
<table class="shadow-lg bg-white table-auto">
<thead>
<tr>
<th class="border text-left px-8 py-4">ID</th>
<th class="border text-left px-8 py-4">URL</th>
<th class="border text-left px-8 py-4">Format</th>
</tr>
</thead>
<tbody>
% for job in downloads['started_job']:
<tr>
<td class="border px-8 py-4">{{ job['id'] }}</td>
<td class="border px-8 py-4">{{ job['download_manager']['url'] }}</td>
<td class="border px-8 py-4">{{ job['preset']['format'] }}</td>
</tr>
% end
</tbody>
</table>
</div>
% end
</body>
</html>

View File

@ -0,0 +1,28 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="static/style.css" rel="stylesheet">
<link rel="icon" type="image/x-icon" href="static/favicon.png">
<title>{{ title }} - ydl_api_ng web UI</title>
</head>
<body>
<div class="container mx-auto p-4 m-4 mb-0">
<form action="/" method="POST" class="w-full max-w-sm">
<div class="flex py-2">
<input
type="text"
id="url"
name="url"
placeholder="https://youtu.be/dQw4w9WgXcQ"
class="w-full rounded-md border-gray-300 sm:text-sm"
required>
<button
type="submit"
class="flex-shrink-0 bg-red-600 hover:bg-red-500 p-2 mx-2 text-white font-bold rounded-md">
Get!
</button>
</div>
</form>
</div>

View File

@ -0,0 +1,43 @@
% include('templates/header.tpl', title='Download video from YouTube and more')
% if video:
<div class="container mx-auto p-4 pt-0 m-4 mt-0">
<h1 class="text-3xl font-bold mb-4">{{ video['title'] }}</h1>
<div class="grid grid-cols-1 md:grid-cols-3 gap-8">
<div>
<img class="w-full aspect-video" src="{{ video['thumbnail'] }}" alt="Thumbnail">
</div>
<div class="col-span-2">
<p>Video by
<a href="{{ video['channel_url'] }}"
class="text-red-600 hover:text-red-500"
target="_blank">
{{ video['channel'] }}
</a>
<p><span class="font-bold">Duration:</span> {{ video['duration_in_hms'] }}</p>
<p><span class="font-bold">Link:</span>
<a href="{{ video['original_url'] }}"
class="text-red-600 hover:text-red-500"
target="_blank">
{{ video['original_url'] }}
</a></p>
<div>
<form action="/downloads" method="POST">
<input
type="text"
id="video"
name="video",
value="{{ video['original_url'] }}"
style="display: none">
<button
type="submit"
class="bg-red-600 hover:bg-red-500 p-2 my-4 text-white font-bold rounded-md">
Download
</button>
</form>
</div>
</div>
</div>
</div>
% end
</body>
</html>