-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
105 lines (96 loc) · 2.99 KB
/
index.html
File metadata and controls
105 lines (96 loc) · 2.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
<!-- index.html -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>YouTube Downloader</title>
<style>
body {
background-color: #121212;
color: #e0e0e0;
font-family: Arial, sans-serif;
padding: 30px;
}
h1 {
text-align: center;
color: #fff;
}
input, select, button {
width: 100%;
padding: 12px;
margin: 10px 0;
border: none;
border-radius: 4px;
font-size: 16px;
}
input, select {
background-color: #1e1e1e;
color: #fff;
}
button {
background-color: #03dac6;
color: #000;
cursor: pointer;
transition: background 0.3s;
}
button:hover {
background-color: #00c4b4;
}
.progress {
margin-top: 20px;
}
.folder-path {
font-size: 14px;
color: #aaa;
margin-bottom: 10px;
}
</style>
</head>
<body>
<h1>YouTube Downloader</h1>
<button id="selectFolderBtn">📁 Select Download Folder</button>
<div class="folder-path" id="folderPath">📂 No folder selected</div>
<input id="urlInput" type="text" placeholder="Paste YouTube URL here" />
<select id="formatSelect">
<option value="webm">WebM (best quality)</option>
<option value="mp3">MP3 (convert)</option>
</select>
<button id="downloadBtn">Download</button>
<div class="progress" id="progressText">Progress: 0%</div>
<script>
const urlInput = document.getElementById('urlInput');
const formatSelect = document.getElementById('formatSelect');
const downloadBtn = document.getElementById('downloadBtn');
const selectFolderBtn = document.getElementById('selectFolderBtn');
const folderPathDisplay = document.getElementById('folderPath');
const progressText = document.getElementById('progressText');
const updateFolderDisplay = (path) => {
folderPathDisplay.textContent = path ? `📂 ${path}` : '📂 No folder selected';
};
selectFolderBtn.addEventListener('click', async () => {
const folder = await window.electronAPI.selectDownloadFolder();
updateFolderDisplay(folder);
});
downloadBtn.addEventListener('click', () => {
const url = urlInput.value.trim();
const format = formatSelect.value;
if (url) {
window.electronAPI.downloadAudio(url, format);
progressText.textContent = 'Starting...';
}
});
window.electronAPI.onProgress((percent) => {
progressText.textContent = `Progress: ${percent}%`;
});
window.electronAPI.onComplete(() => {
progressText.textContent = '✅ Download complete!';
});
window.electronAPI.onError((message) => {
progressText.textContent = `❌ Error: ${message}`;
});
// Load saved folder on app start
window.electronAPI.getSavedFolder().then(updateFolderDisplay);
</script>
</body>
</html>