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-information-parser

v1.0.7

Published

node module to parse the source video url of a youtube video

Downloads

5

Readme

Youtube Information Parser

npm

This module allows you to retrieve information about title, creator, clicks, thumbnails and raw video urls of any youtube video you want!

Installation

To install this module, simply run the following command:

npm install --save youtube-url-parser

Usage

The first thing you have to do is to import it:

import * from "youtube-url-parser";

After that, you can create a new YoutubeLoader object like this:

let loader: YoutubeLoader = new YoutubeLoader("https://youtube.com/watch?v=VIDEO_ID");

Execute the getVideoLinks() function to retrieve all information about the video. This function returns a promise, which means you can either use the .then(...) and .catch(...) functions or prefix the function call with a await statement to handle asynchronous behavior.

When you only need the StreamingInfo which contains the video of the highest quality, execute the getBestQualityStreamingInfo(filters?: Filter): Promise<StreamingInfo> function. This will return the StreamingInfo with the highest video dimensions. To retrieve only videos which match specific attributes, like audio: true, specify them in the optional filters parameter. The parameter is of type [FilterType, keyof StreamingInfo, any][] which means, that you can provide an array of 3-tuples. The first element of the tuple represents the comparison type (e.g. ==, <=, >=, ...), the second the key you want to check (e.g. "audio") and the last element represents the value of the key (e.g. true). To retrieve the video with the highest quality which contains audio, you would call:

getBestQualityStreamingInfo([[FilterType.EQUAL, "audio", true]])

To filter for a set of StreamingInfo, that match your filter conditions, use the getFilteredStreamingInfo(filters: Filter): Promise<StreamingInfo[]> function.

Download videos

To download a youtube video, the easiest way to do so is to create a new instance of the YoutubeDownloader class. Provide the URL of the youtube video and the download location (relative Path with filename) as parameters in the constructor. After that execute the downloadBestQuality(): Promise<string> to download the video with the highest video quality. You can otherwise search for a StreamingInfo and download the video with the specific StreamingInfo.

Contribution

This project is work in progress. Feel free to create pull requests or report bugs using the github issue tracker!