Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

youtube-video-dl

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

youtube-video-dl

Youtube video downloader

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
decreased by-66.67%
Maintainers
1
Weekly downloads
 
Created
Source

Youtube-Video-Metric

MIT license image

A TypeScript Version of Youtube Video Metric

If you want to use it in node js without typescript you need to specify "type" : "module" in your package.json

Table Of Contents

  1. Description
  2. Installation 2.1 Server Side 2.2 Client Side 2.3 Setup Proxy 2.4 Setup CDN
  3. Example 3.1 Download a video 3.1.1 Server Side 3.1.2 Client Side
  4. License

Description

This repository provides a downloader who will help you to download a youtube video

Installation

Server Side

Run this command to install it

npm i youtube-video-dl

Client Side

Or import it in your browser

<script type="module">
    import Downloader from '../dist/index.mjs';
</script>

Setup Proxy

You also need to setup a proxy (Hello Cors), but don't worry i provide you a small handler to do it

Create a new file server.js Copy / Paste the following code

import { Server } from 'youtube-video-transcript';
Server.default.listen(8080);

Then run node server.js

Setup Cdn

All the following exemple will use the file mjs in local assuming that you have run the npm install command but if you don't want to it you can use the following

<script type="module">
    import Transcriptor from 'https://cdn.jsdelivr.net/npm/youtube-video-dl/dist/index.mjs';
</script>

But you will need to install a proxy like tiny-cors-proxy to bypass the cors option

You can install this package via npm:

npm install tiny-cors-proxy

Then create a new file server.js and paste the following snipset :

import Server from 'tiny-cors-proxy';
Server.listen(8080);

Then run node server.js

Example

Download a video

Server Side

Quickly import and translate the video of your choice !

import Inspector from 'youtube-video-dl';
await Downloader.download('https://www.youtube.com/watch?v=et9gw5xbtoY', '144p', 'toto.mp4')
Client Side

If you are working directly in your browser (you must setup a proxy server)

<!DOCTYPE html>
<html>
<head>
    <title>Download a video</title>
</head>
<body>
    <button>Download a video</button>
</body>
<script type="module">
    import Downloader from '../dist/index.mjs';
    document.querySelector('button').addEventListener('click', () => {
        await Downloader.setProxy('http://localhost:8080').download('https://www.youtube.com/watch?v=et9gw5xbtoY');
    });
</script>
</html>

License

This project is licensed under the MIT license

Keywords

FAQs

Package last updated on 10 May 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc