0.0.13 • Published 2 years ago

ytutil v0.0.13

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

ytUtil

YouTube Utils

Disclaimer

This package is under developing, and there's no error processing.

How to use

Download Stream for discord.js

return webm opus stream for discord.js

const { ytUtil } = require("ytutil");
const downloader = new ytUtil();

async function main() {
  await downloader.download("youtube url here");
}

main();

await required.

Download Stream for discord.js without validate of URL

return webm opus stream for discord.js

const { ytUtil } = require("ytutil");
const downloader = new ytUtil();

async function main() {
  downloader.downloadRaw("youtube url here");
}

main();

await required.

The video is valid or invalid

return boolean

const { ytUtil } = require("ytutil");
const downloader = new ytUtil();

async function main() {
  console.log(await downloader.isValidVideo("youtube url here"));
}

main();

await required.

Search video on YouTube

return:

[
  {
    description: '',
    duration: 213000,
    duration_raw: '3:33',
    uploaded: '7 years ago',
    views: 3426315239,
    channel: {
      name: 'Alan Walker',
      link: 'https://www.youtube.com/channel/UCJrOtniJ0-NWz37R30urifQ',
      verified: true
    },
    id: '60ItHLz5WEA',
    link: 'https://www.youtube.com/watch?v=60ItHLz5WEA',
    thumbnail: 'https://i.ytimg.com/vi/60ItHLz5WEA/maxresdefault.jpg',
    title: 'Alan Walker - Faded',
    shareLink: 'https://youtu.be/60ItHLz5WEA'
  },
  ...
]
const { ytUtil } = require("ytutil");
const downloader = new ytUtil();

async function main() {
  return await downloader.search("Alan Walker");
}

console.log(main());

await required.

Download stream for discord.js from search

return webm and opus stream

const { ytUtil } = require("ytutil");
const downloader = new ytUtil();

async function main() {
  await downloader.downloadFromSearch("Alan Walker");
}

main();

await required.

Save file to path

Save file to path

const { ytUtil } = require("ytutil");
const downloader = new ytUtil();

async function main() {
  await downloader.save("youtube url here", "./path here");
}

main();

await required.

Save from search

Save file to path

const { ytUtil } = require("ytutil");
const downloader = new ytUtil();

async function main() {
  await downloader.saveFromSearch("Alan Walker", "./path here");
}

main();

await required.

Get video info

return:

[ 'Alan Walker - Faded', 'Alan Walker', '213' ]
const { ytUtil } = require("ytutil");
const downloader = new ytUtil();

async function main() {
  console.log(await downloader.getVideoInfo("youtube url here"));
}

main();

await required.

Spotify to YouTube

return:

https://www.youtube.com/watch?v=60ItHLz5WEA
const { ytUtil } = require("ytutil");
const downloader = new ytUtil();

async function main() {
  console.log(
    await downloader.spotifyToYT(
      "https://open.spotify.com/track/698ItKASDavgwZ3WjaWjtz"
    )
  );
}

main();

await required.

Diagnostic dependencies

return:

ytdl-core: Ok
@yimura/scraper: Ok
ytpl: Ok
isomorphic-unfetch: Ok
spotify-url-info: Ok
const { ytUtil } = require("ytutil");
const downloader = new ytUtil();

async function main() {
  console.log(downloader.diagnosticDependencies());
}

main();

No await required.

0.0.13

2 years ago

0.0.12

2 years ago

0.0.11

2 years ago

0.0.10

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago