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 🙏

© 2024 – Pkg Stats / Ryan Hefner

youtube-video-dl

v1.0.1

Published

Youtube video downloader

Downloads

115

Readme

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