UNPKG

@ernestoyoofi/yt.loader-to

Version:

Simple api youtube downloader is not official from en.loader.to

163 lines (132 loc) โ€ข 4.25 kB
# @ernestoyoofi/yt.loader-to [Readme for "Bahasa Indonesia"](./README-ID.md) Simple api youtube downloader is not official from en.loader.to. A simple node.js downloading video or audio from youtube. ## ๐Ÿ“‚ Instalation You can install with npm or yarn. ```bash npm i @ernestoyoofi/yt.loader-to --save ``` ```bash yarn add @ernestoyoofi/yt.loader-to ``` ## โœ๏ธ Usage ```js const yt = require("@ernestoyoofi/yt.loader-to") ``` ## โšก yt.download ```js // Details, check in files test.js const yt = require("@ernestoyoofi/yt.loader-to") // ๐Ÿ“‚ Download Media yt.download({ yt_link: "https://music.youtube.com/watch?v=m8Zqd58XuoA&list=OLAK5uy_n0t6KymP-tb3EUjViyWXXA4cT1raHJEl8", // Enter the YouTube video url here yt_format: "mp3", // Choose several formats to download, you can see it in the script configuration ./lib/config.js logs: true, // Just for check running (default: false) saveId: true // saves url to load in case anyone downloads with same url id (default: false) }).then(results => { console.log(results) }) ``` Results, This data appears after the download is complete. ```js // Results data in time 18/04/2023 (Asia/Jakarta) { info: { image: 'https://i.ytimg.com/vi/m8Zqd58XuoA/hqdefault.jpg', title: 'Kawaii Aesthetic', description: 'Provided to YouTube by IIP-DDS\n' + '\n' + 'Kawaii Aesthetic ยท Tollan Kim\n' + '\n' + 'Kawaii Aesthetic\n' + '\n' + 'โ„— Tollan Kim\n' + '\n' + 'Released on: 2022-06-15\n' + '\n' + 'Composer: Lucas de Oliveira Santos\n' + '\n' + 'Auto-generated by YouTube.', view: 1571, like: 26, id: 'm8Zqd58XuoA', yt_url: 'https://youtu.be/m8Zqd58XuoA?feature=share', channel: { pp: 'https://yt3.ggpht.com/iAwS5R6mvBqkzrGVqgMdHOWZy38gdZnoa4quANIQ4wzkWs2YmspKvLCzG9sK3lTba86KvC4E7A=s48-c-k-c0x00ffffff-no-rj', name: 'Tollan Kim - Topik', url_ch: 'https://youtube.com/channel/UCJmVKm8H-Pe62TumtF0bZTQ' } }, media: 'https://marilyn7.oceansaver.in/pacific/?k7Ck2foXI1QgGl9rQ37bjBE9HXQ' } ``` ## โšก yt.info ```js // Details, check in files test.js const yt = require("@ernestoyoofi/yt.loader-to") // ๐Ÿ“ƒ Youtube Information Video yt.ytInfo({ yt_link: "https://youtube.com/watch?v=4V4hl7xMBN4" // Enter the YouTube video url here }).then(results => { console.log(results) }) ``` The result data after the request is completed. ```js // Results data in time 18/04/2023 (Asia/Jakarta) { image: 'https://i.ytimg.com/vi/4V4hl7xMBN4/hqdefault.jpg', title: 'METAMORPHOSIS (Arabic Version)', description: 'Provided to YouTube by DistroKid\n' + '\n' + 'METAMORPHOSIS (Arabic Version) ยท YAD Oud\n' + '\n' + 'METAMORPHOSIS (Arabic Version)\n' + '\n' + 'โ„— YAD Oud\n' + '\n' + 'Released on: 2023-01-19\n' + '\n' + 'Auto-generated by YouTube.', view: 79102, like: 3, id: '4V4hl7xMBN4', yt_url: 'https://youtu.be/4V4hl7xMBN4?feature=share', channel: { pp: 'https://yt3.ggpht.com/pvRn3YQ-taoDHVAovO7zY1KaGlOUCKiyc2u5TYChpZXfhaaKY_dIkY9JHHrYcWsVBB4QB7b2GQ=s48-c-k-c0x00ffffff-no-rj', name: 'YAD Oud', url_ch: 'https://youtube.com/channel/UCKy7co9mviDMq6u2JIL_Rsw' } } ``` ## ๐Ÿช„ Another variable ```js // ๐Ÿ“ƒ Config const yt = require("@ernestoyoofi/yt.loader-to") console.log(yt._cfg.yt_host) // Return โ†’ ["music.youtube.com", "www.youtube.com", "www.youtube-nocookie.com", "youtube.com", "youtu.be"] console.log(yt._cfg.format) // Return โ†’ { // video: ["480","720","1080","1440","4k","8k"], // audio: ["mp3","ogg","wav","m4a","webm","aac","opus"] // } console.log(yt._cfg.host) // Return โ†’ "https://loader.to" ``` ```js // ๐Ÿช„ Validation const yt = require("@ernestoyoofi/yt.loader-to") yt._valid.youtube_url("https://music.youtube.com/watch?v=v6HFc5I0hr8") // Return โ†’ { // valid: true, // id: "v6HFc5I0hr8" // } yt._valid.format_download("1080") // Return โ†’ { // format: "1080", // media_type: "video" // } yt._valid.get_url_ajax("info") // Return โ†’ "https://loader.to/ajax/download.php" ```