npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@ytb-dw/sdk

v1.0.1

Published

Official JavaScript SDK for ytb-dw YouTube download service - Download YouTube videos and audio with ease

Downloads

20

Readme

@ytb-dw/sdk

SDK officiel JavaScript/Node.js pour le service de téléchargement YouTube ytb-dw.

Installation

npm install @ytb-dw/sdk

Usage rapide

Node.js

const YtbDwClient = require('@ytb-dw/sdk');

const client = new YtbDwClient('votre-cle-api');

// Obtenir les informations d'une vidéo
const info = await client.getVideoInfo('https://youtube.com/watch?v=dQw4w9WgXcQ');
console.log(info.title, info.duration);

// Télécharger en MP3
await client.downloadToFile(
  'https://youtube.com/watch?v=dQw4w9WgXcQ',
  'audio.mp3',
  { format: 'audio' }
);

// Télécharger en vidéo 720p
await client.downloadToFile(
  'https://youtube.com/watch?v=dQw4w9WgXcQ',
  'video.mp4',
  { format: 'video', quality: '720' }
);

Navigateur

<script src="https://cdn.jsdelivr.net/npm/@ytb-dw/sdk@latest/index.js"></script>
<script>
const client = new YtbDwClient('votre-cle-api');

// Obtenir les informations d'une vidéo
client.getVideoInfo('https://youtube.com/watch?v=dQw4w9WgXcQ')
  .then(info => console.log(info));

// Ouvrir le téléchargement dans un nouvel onglet
client.openDownload('https://youtube.com/watch?v=dQw4w9WgXcQ', {
  format: 'audio'
});
</script>

API

Constructor

const client = new YtbDwClient(apiKey, baseUrl?)
  • apiKey: Votre clé API ytb-dw (obligatoire)
  • baseUrl: URL de base de l'API (optionnel, par défaut: https://ytb-dw-api.onrender.com)

Méthodes

getVideoInfo(url)

Récupère les métadonnées d'une vidéo sans la télécharger.

const info = await client.getVideoInfo('https://youtube.com/watch?v=VIDEO_ID');
// Retourne: { success, title, duration, uploader, view_count, formats }

downloadVideo(url, options)

Télécharge une vidéo avec des options personnalisées.

const response = await client.downloadVideo('https://youtube.com/watch?v=VIDEO_ID', {
  format: 'video', // 'audio' ou 'video'
  quality: '720'   // '480', '720', '1080', 'best'
});

downloadAudio(url)

Raccourci pour télécharger l'audio uniquement.

const response = await client.downloadAudio('https://youtube.com/watch?v=VIDEO_ID');

downloadVideoQuality(url, quality)

Raccourci pour télécharger une vidéo dans une qualité spécifique.

const response = await client.downloadVideoQuality('https://youtube.com/watch?v=VIDEO_ID', '1080');

getDownloadUrl(url, options)

Génère l'URL de téléchargement (utile pour les navigateurs).

const downloadUrl = client.getDownloadUrl('https://youtube.com/watch?v=VIDEO_ID', {
  format: 'audio'
});

downloadToFile(url, filename, options) (Node.js seulement)

Télécharge et sauvegarde directement dans un fichier.

await client.downloadToFile(
  'https://youtube.com/watch?v=VIDEO_ID',
  './downloads/video.mp4',
  { format: 'video', quality: '720' }
);

openDownload(url, options) (Navigateur seulement)

Ouvre le téléchargement dans un nouvel onglet.

client.openDownload('https://youtube.com/watch?v=VIDEO_ID', {
  format: 'audio'
});

Gestion des erreurs

Le SDK gère automatiquement les erreurs HTTP et fournit des messages d'erreur clairs :

try {
  const info = await client.getVideoInfo('invalid-url');
} catch (error) {
  console.error('Erreur:', error.message);
  // Exemple: "HTTP 400: Bad Request - Missing or invalid parameters"
}

Codes d'erreur

  • 400: Paramètres manquants ou invalides
  • 401: Clé API invalide ou inactive
  • 403: Format non autorisé pour votre compte
  • 404: Vidéo introuvable ou privée
  • 429: Quota quotidien dépassé
  • 500: Erreur serveur temporaire

Limites

  • Gratuit: 10 téléchargements/jour
  • Premium: 100 téléchargements/jour
  • Unlimited: Illimité
  • Timeout: 15 minutes max par téléchargement
  • Taille max: 2 Go par fichier
  • Concurrent: 3 téléchargements simultanés

Support

  • Documentation: https://ytb-dw.social-networking.me/docs
  • Issues: https://github.com/ytb-dw/sdk/issues
  • Email: [email protected]

Licence

MIT