youtube-scrapper

Download videos and get info on them aswell as searching and other features.

Usage no npm install needed!

<script type="module">
  import youtubeScrapper from 'https://cdn.skypack.dev/youtube-scrapper';
</script>

README

youtube-scrapper

NPM Version NPM Downloads

Table Of Contents

Links

Installing

Simply use npm i youtube-scrapper.

Example

const scrapper = require("youtube-scrapper")
const { createWriteStream } = require("fs")

async function main() {
    // Getting videos through query.
    const result = await scrapper.search("best hits 2010")

    console.log(result.videos.map(vid => vid.details.title)) // Array of videos mapped by name.

    // Downloading first result and piping to a file.
    // We have to get the full song info first.
    const video = await scrapper.getVideoInfo(result.videos[0].id)

    // Write to file.
    scrapper
        .downloadFromVideo(video)
        .pipe(createWriteStream("./song.ogg"))
}

main()