Compare commits

..

No commits in common. "main" and "v0.9.0" have entirely different histories.
main ... v0.9.0

6 changed files with 574 additions and 670 deletions

View file

@ -2,7 +2,6 @@
![version](https://git.pweapon.org/odo/dl.emersa.it/badges/release.svg 'version')
![status](https://git.pweapon.org/odo/dl.emersa.it/badges/workflows/ci.yaml/badge.svg 'status')
![GNU](https://img.shields.io/badge/license-GPL--3.0-green?logo=gnu)
It's a svelte(kit) frontend + backend that uses [`yt-dlp`](https://github.com/yt-dlp/yt-dlp) to let people download audio/video files from the web.

1080
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -1,7 +1,7 @@
{
"name": "dl.emersa.it",
"private": true,
"version": "0.9.3-c",
"version": "0.9.0",
"type": "module",
"scripts": {
"dev": "vite dev",
@ -15,34 +15,34 @@
"lint": "prettier --check . && eslint ."
},
"devDependencies": {
"@eslint/compat": "^1.2.8",
"@eslint/js": "^9.25.0",
"@eslint/compat": "^1.2.7",
"@eslint/js": "^9.21.0",
"@sveltejs/adapter-node": "^5.2.12",
"@sveltejs/kit": "^2.20.7",
"@sveltejs/kit": "^2.17.3",
"@sveltejs/vite-plugin-svelte": "^5.0.3",
"@tailwindcss/vite": "^4.1.4",
"eslint": "^9.25.0",
"eslint-config-prettier": "^10.1.2",
"eslint-plugin-svelte": "^3.5.1",
"@tailwindcss/vite": "^4.0.9",
"eslint": "^9.21.0",
"eslint-config-prettier": "^10.0.1",
"eslint-plugin-svelte": "^2.46.1",
"globals": "^16.0.0",
"mdsvex": "^0.12.3",
"prettier": "^3.5.3",
"prettier": "^3.5.2",
"prettier-plugin-svelte": "^3.3.3",
"prettier-plugin-tailwindcss": "^0.6.11",
"svelte": "^5.28.1",
"svelte-check": "^4.1.6",
"sveltekit-sse": "^0.13.18",
"tailwindcss": "^4.1.4",
"typescript": "^5.8.3",
"typescript-eslint": "^8.30.1",
"vite": "^6.3.2"
"svelte": "^5.20.4",
"svelte-check": "^4.1.4",
"sveltekit-sse": "^0.13.14",
"tailwindcss": "^4.0.9",
"typescript": "^5.7.3",
"typescript-eslint": "^8.25.0",
"vite": "^6.2.0"
},
"dependencies": {
"@tailwindcss/forms": "^0.5.10",
"@tailwindcss/postcss": "^4.1.4",
"@tailwindcss/postcss": "^4.0.9",
"@tailwindcss/typography": "^0.5.16",
"@types/node": "^22.14.1",
"@types/node": "^22.13.5",
"winston": "^3.17.0",
"youtube-dl-exec": "^3.0.20"
"youtube-dl-exec": "^3.0.16"
}
}

View file

@ -17,11 +17,4 @@
transform: rotate(180deg);
display: inline-block;
}
@media screen and (max-height: 600px) {
/* Your CSS rules here */
footer {
display: none;
}
}
</style>

View file

@ -18,10 +18,6 @@
const formats = Object.keys(supportedFormats).map((f) => {
return { value: f, label: f.toUpperCase() };
});
const sources = [
{ value: 'youtube', label: 'YouTube' },
{ value: 'youtube', label: 'Any Other Website' }
];
const toggleModal = () => {
showModal = !showModal;
@ -94,7 +90,7 @@
<div
id="wrapper"
class="relative mx-auto rounded-lg bg-black p-6 text-[#00ff7f] shadow-lg sm:mt-10 sm:max-w-sm sm:border-4 sm:border-[#00ff7f] lg:max-w-lg 2xl:max-w-2xl"
class="relative mx-auto rounded-lg bg-black p-6 text-[#00ff7f] shadow-lg sm:max-w-sm sm:border-4 sm:border-[#00ff7f] md:mt-10 md:max-w-md lg:max-w-lg 2xl:max-w-2xl"
>
<div
id="loader"
@ -122,40 +118,47 @@
<p id="title" class="mb-6 text-center text-[#00e5ff]">🐙 Scaricatore 🐙</p>
<form class="space-y-6">
<!-- Source selection -->
<div class="flex justify-between">
<div class="w-2/6 lg:w-3/6">
<label for="source" class="mb-2 block text-[#00e5ff]"> Choose Source: </label>
<select
id="source"
name="source"
bind:value={source}
class="w-full rounded-lg border-4 border-[#00ff7f] bg-[#001a00] px-4 py-3 text-[#00ff7f] focus:border-[#ff3399] focus:outline-none"
>
{#each sources as source}
<option value={source.value}>{source.label}</option>
{/each}
</select>
</div>
<!-- Source Selection -->
<fieldset class="space-y-4">
<legend class="text-[#00e5ff]">Choose Source:</legend>
<label class="flex items-center space-x-3">
<input type="radio" name="source" value="youtube" bind:group={source} class="retro-radio" />
<span>YouTube</span>
</label>
<label class="flex items-center space-x-3">
<input
disabled
type="radio"
name="source"
value="spotify"
bind:group={source}
class="retro-radio"
/>
<span class="not-available">Spotify</span>
</label>
<label class="flex items-center space-x-3">
<input type="radio" name="source" value="other" bind:group={source} class="retro-radio" />
<span>
Any other website
<!--
(<a
href="https://github.com/yt-dlp/yt-dlp/blob/master/supportedsites.md"
target="_blank"
rel="noopener noreferrer"
class="text-[#ff3399] hover:underline"
>supported sites
</a>)
-->
</span>
</label>
</fieldset>
<!-- Format Selection -->
<div class="w-2/6">
<label for="format" class="mb-2 block text-[#00e5ff]"> Choose Format: </label>
<select
id="format"
name="format"
bind:value={format}
class="w-full rounded-lg border-4 border-[#00ff7f] bg-[#001a00] px-4 py-3 text-[#00ff7f] focus:border-[#ff3399] focus:outline-none"
>
{#each formats as format}
<option value={format.value}>{format.label}</option>
{/each}
</select>
</div>
</div>
<!-- Link Input -->
<div>
<label for="link" class="mb-2 block text-[#00e5ff]"> Enter Video Link: </label>
<label for="link" class="mb-2 block text-[#00e5ff]"> Enter Playlist or Video Link: </label>
<input
name="link"
type="url"
@ -167,6 +170,21 @@
/>
</div>
<!-- Format Selection -->
<div>
<label for="format" class="mb-2 block text-[#00e5ff]"> Choose Format: </label>
<select
id="format"
name="format"
bind:value={format}
class="w-full rounded-lg border-4 border-[#00ff7f] bg-[#001a00] px-4 py-3 text-[#00ff7f] focus:border-[#ff3399] focus:outline-none"
>
{#each formats as format}
<option value={format.value}>{format.label}</option>
{/each}
</select>
</div>
<!-- Metadata -->
<div>
<label for="metadata" class="mb-2 block text-[#00e5ff]"
@ -231,8 +249,7 @@
font-size: 10px;
}
}
@media (min-width: 1400px) {
@media (min-width: 1024px) {
* {
font-size: 12px;
}
@ -241,12 +258,31 @@
#loader {
display: none;
}
#loader.downloading {
display: grid;
justify-items: center;
align-items: center;
}
.not-available {
text-decoration-line: line-through;
text-decoration-color: red;
}
.retro-radio {
appearance: none;
background-color: #000;
border: 2px solid #00ff7f;
width: 20px;
height: 20px;
cursor: pointer;
}
.retro-radio:checked {
background-color: #00ff7f;
box-shadow:
0 0 4px #00ff7f,
0 0 10px #00ff7f;
}
input[type='url'],
select {

View file

@ -38,7 +38,7 @@ const validateRequest = (url: URL) => {
};
export const GET: RequestHandler = async ({ url }) => {
const { format, source, metadata, link } = validateRequest(url);
let filename = `noname.${format}`;
let filename = `you-clicked-no-metadata-so-i-cant-put-a-correct-name.${format}`;
if (!!metadata) {
try {
@ -59,7 +59,7 @@ export const GET: RequestHandler = async ({ url }) => {
// Stream video/audio
return new Response(streamYouTube(link, format), {
headers: {
'Content-Type': `${mimeTypeMap.get(format)}`,
'Content-Type': 'text/event-stream',
'Content-Disposition': `attachment; filename="${filename}"`,
'Set-Cookie': 'downloading=0'
}