├── .github └── FUNDING.yml ├── README.md ├── index.js ├── package.json └── videos └── placholder.txt /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | custom: ['milrato.eu', 'dc.milrato.eu', 'bero.milrato.eu', 'bittmax.milrato.eu' ] 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # videos-downloader 2 | > *Allows you to download Youtube, Facebook, FSK18 Videos and more!* 3 | 4 | # Installation: 5 | 6 | ### 1. DOWNLOAD THE GIT VIA COMMAND (you can do it manually too!) 7 | > ``` 8 | > git clone https://github.com/Tomato6966/videos-downloader 9 | > ``` 10 | 11 | ### 2. GO IN THE FOLDER 12 | > ``` 13 | > cd videos-downloader 14 | > ``` 15 | 16 | ### 3. INSTALL LIBRARIES 17 | > ``` 18 | > npm install 19 | > ``` 20 | 21 | ### 4. - START IT 22 | > ``` 23 | > node . 24 | > ``` 25 | 26 | ### 5. - TEST IT 27 | > ``` 28 | > JUST PASTE A LINK, example: [I WONT PASTE WHAT YOU WANT :eyes:] https://www.youtube.com/watch?v=G5pV2005fMQ&t=1s 29 | > ``` 30 | 31 | # Works for almost every Link!, from youtube, over facebook, tiktok, twitter, instagram and even fsk18 sites! List: 32 | > https://links.musicium.eu 33 | 34 |
35 | 36 | *** 37 | 38 | ## [Discord Server 😎](https://discord.gg/milrato) | [Website](https://milrato.dev) 39 | 40 | 41 | *** 42 | 43 | ## SUPPORT ME AND MILRATO DEVELOPMENT 44 | 45 | > You can always Support me by inviting one of my **own Discord Bots** 46 | 47 | [![2021's best Music Bot | Lava Music](https://cdn.discordapp.com/attachments/748533465972080670/817088638780440579/test3.png)](https://lava.milrato.dev) 48 | [![Musicium Music Bot](https://cdn.discordapp.com/attachments/742446682381221938/770055673965707264/test1.png)](https://musicium.musicium.dev) 49 | [![Milrato Multi Bot](https://cdn.discordapp.com/attachments/742446682381221938/770056826724679680/test1.png)](https://milrato.milrato.dev) 50 | 51 | # Credits 52 | 53 | > If consider using this Bot, make sure to credit me! 54 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | const youtubedl = require('youtube-dl') 2 | const readline = require('readline'); 3 | const fs = require("fs") 4 | colors = require("colors") 5 | //Logging improved 6 | __originalLog = console.log; 7 | console.log = function () { 8 | var args = [].slice.call(arguments); 9 | __originalLog.apply(console.log, [" [+] ".magenta].concat(args)); 10 | }; 11 | function askQuestion(query) { 12 | const rl = readline.createInterface({ 13 | input: process.stdin, 14 | output: process.stdout, 15 | }); 16 | return new Promise(resolve => rl.question(query, ans => { 17 | rl.close(); 18 | resolve(ans); 19 | })) 20 | } 21 | async function t(){ 22 | try{ 23 | var counter = 0; 24 | var extratext = `Waiting for user input`; 25 | var myvar = setInterval(()=>{ 26 | var arr = ["/", "-", "\\", "|",]; 27 | require("node-bash-title")(`[ ${arr[counter]} ] ${extratext} ${".".repeat(counter)}`) 28 | counter++; 29 | if(counter == arr.length) counter = 0; 30 | }, 350) 31 | console.log("Example Link: ".green + "https://youtu.be/6xDyPcJrl0c".yellow + " or: ".green + "https://www.youtube.com/watch?v=fJ9rUzIMcZQ".yellow+ "\n\n") 32 | const ans = await askQuestion(" [+] ".magenta + "Paste the YOUTUBE LINK: ".brightYellow); 33 | 34 | extratext = `Getting Video Data`; 35 | 36 | //https://youtu.be/6xDyPcJrl0c 37 | 38 | var output = 'myvideo.mp4' 39 | let downloaded = 0 40 | const video = youtubedl(ans, ['--format=18', '-f', "best[ext=mp4]/best"], { start: downloaded, cwd: __dirname }) 41 | video.on('info', function(info) { 42 | //console.log('\033[2J'); --> if you wanna remove the input part (i want to keep it so i commented it out) 43 | console.log('Download started'.brightGreen) 44 | output = "./videos/" + info._filename.split(" ").join("_").replace(/[&\/\\#!,+()$~%.'\s":*?<>{}]/g,'_').substr(0, 30) + ".mp4"; 45 | if (fs.existsSync(output)) { 46 | fs.unlinkSync(output) 47 | fs.openSync(output, "w") 48 | } 49 | else fs.openSync(output, "w") 50 | console.log('FILENAME: '.brightGreen + String(output).brightYellow) 51 | let total = info.size + downloaded 52 | console.log('SIZE: '.brightGreen + String(Math.floor(Number(total)/1000)/100+" Mbits").brightYellow) 53 | video.pipe(fs.createWriteStream(output, { flags: 'a' })) 54 | 55 | extratext = `Downloading` 56 | }) 57 | video.on('complete', function complete(info) { 58 | 'use strict' 59 | console.log(String('filename: ' + info._filename + ' already Downloaded.').brightGreen) 60 | }) 61 | video.on('end', function() { 62 | clearInterval(myvar); 63 | require("node-bash-title")(`Downloaded: ${output}`) 64 | console.log('Finished Downloading!'.bold.brightGreen) 65 | require('child_process').exec('start "" "videos"'); 66 | console.log("closing Exe File in 3 Seconds ...".grey) 67 | setTimeout(()=>{ 68 | return console.log("CLOSED") 69 | }, 3000) 70 | }) 71 | }catch(e){ 72 | console.log(e) 73 | } 74 | } 75 | t(); -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "colors": "^1.4.0", 4 | "fs": "^0.0.1-security", 5 | "node-bash-title": "^0.0.2", 6 | "readline": "^1.3.0", 7 | "youtube-dl": "^3.5.0", 8 | "youtube-dl-exec": "^1.2.3" 9 | }, 10 | "name": "links-videos-downloader", 11 | "version": "1.4.6", 12 | "description": "A Downloader for youtube, instagram, facebook, tik tok, and even fsk 18 stuff", 13 | "main": "index.js", 14 | "devDependencies": {}, 15 | "scripts": { 16 | "test": "echo \"Error: no test specified\" && exit 1", 17 | "start": "node ." 18 | }, 19 | "author": "Tomato#6966", 20 | "license": "ISC" 21 | } 22 | -------------------------------------------------------------------------------- /videos/placholder.txt: -------------------------------------------------------------------------------- 1 | F --------------------------------------------------------------------------------