Repository files navigation # dropload — setup
## Prérequis
```bash
# Node.js 18+
node -v
# yt-dlp
pip install yt-dlp
# ou sur Linux :
sudo curl -L https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp -o /usr/local/bin/yt-dlp
sudo chmod a+rx /usr/local/bin/yt-dlp
# ffmpeg (obligatoire pour 1080p/4K)
# Ubuntu/Debian :
sudo apt install ffmpeg
# macOS :
brew install ffmpeg
# Windows : https://ffmpeg.org/download.html → ajouter au PATH
```
## Install & run
```bash
npm install
npm start
# → http://localhost:3000
```
## Structure
```
dropload/
├── server.js ← backend Express + yt-dlp
├── package.json
├── tmp/ ← fichiers temporaires (auto-nettoyé)
└── public/
└── index.html ← colle le frontend ici
```
## Comment connecter le frontend au backend
Dans `public/index.html`, remplacer la fonction `fetchVideo()` par :
```js
async function fetchVideo() {
const url = document.getElementById('urlInput').value.trim();
if (!url) return;
const res = await fetch('/api/fetch-info', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ url })
});
const data = await res.json();
if (data.error) { alert(data.error); return; }
document.getElementById('videoTitle').textContent = data.title;
document.getElementById('videoPlatform').textContent = data.platform;
document.getElementById('videoPreview').classList.add('visible');
document.getElementById('qualitySection').classList.add('visible');
document.getElementById('dlWrap').classList.add('visible');
}
```
Et la fonction `startDownload()` par :
```js
async function startDownload() {
const selected = document.querySelector('input[name="quality"]:checked');
if (!selected) return;
if (selected.dataset.locked === 'true' && !hdUnlocked) { openAdModal(); return; }
const url = document.getElementById('urlInput').value.trim();
const res = await fetch('/api/download', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ url, quality: selected.value, hdUnlocked })
});
if (!res.ok) { const e = await res.json(); alert(e.error); return; }
// Déclenche le téléchargement dans le navigateur
const blob = await res.blob();
const a = document.createElement('a');
a.href = URL.createObjectURL(blob);
a.download = 'video_' + selected.value + '.mp4';
a.click();
}
```
## Déploiement (Oracle Cloud Free Tier)
```bash
# Sur la VM
git clone ... && cd dropload
npm install
sudo apt install ffmpeg
pip install yt-dlp
# Lancer avec pm2
npm install -g pm2
pm2 start server.js --name dropload
pm2 save
pm2 startup
```
## Note sur le lock HD côté serveur
Le `hdUnlocked` est envoyé par le client — pour la prod, remplace ça par un token signé (JWT ou session) généré côté serveur quand les 5 pubs sont validées. Le client ne doit pas pouvoir forger ce flag.
# Dropload
About
No description, website, or topics provided.
Resources
Stars
Watchers
Forks
You can’t perform that action at this time.