-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtempCodeRunnerFile.js
More file actions
131 lines (112 loc) · 7.87 KB
/
tempCodeRunnerFile.js
File metadata and controls
131 lines (112 loc) · 7.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
/*const { sys } = require('./Side_Functions/System');
const prompt = require('prompt-sync')({sigint: true});
const {validate} = require('./Side_Functions/validate');
const {lobby} = require('./Side_Functions/lobby');
const {Downloader} = require('./Downloader');
const fs = require('fs')
function phase1(link){
console.log('──────────────────────────────────────────────────────────────────╮');
console.log(' Insert the media link that you want to download │');
console.log('──────────────────────────────────────────────────────────────────╯');
link = prompt(':> ');
console.log('\n')
return link}
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
var verify;
var link;
console.clear()
sleep(1500)
lobby()
do{
if(verify === 0){
console.clear();
sleep(500)
lobby()
console.log('╭───────────────────────────────────────────────────────────────────────────╮');
console.log('│ |');
console.log('│ ❌ ENTRY ERROR: INVALID YOUTUBE MEDIA URL! ❌ │');
console.log('│ |');
console.log('│ Please make sure you entered a valid YouTube media URL and try again. │');
console.log('│ |');
console.log('╰───────────────────────────────────────────────────────────────────────────╯');
}
link = phase1(link);
verify = validate(link, verify)
}while(verify !== 1 && verify !== 2)
do{
if(!fileformat) sleep(700); lobby();
if(fileformat && fileformat !== '.mp3' && fileformat !== 'mp3' && fileformat !== '1' && fileformat !== '.mp4' && fileformat !== 'mp4' && fileformat !== 2){
sleep(700);
lobby();
console.log('╭───────────────────────────────────────────────────────────────────────────╮');
console.log('│ |');
console.log('│ ❌ PROMPT ERROR: INVALID FILE FORMAT VALUE! ❌ │');
console.log('│ |');
console.log('│ Please enter a correct format value │');
console.log('│ (Possible values : .mp3, .mp4, .mkv , .aac (Greatest only)) |');
console.log('╰───────────────────────────────────────────────────────────────────────────╯');
}
console.log('─────────────────────────────────────────────────────────────────────────────────╮');
console.log(' Please choose the file format in which you want the file to be saved │');
console.log('─────────────────────────────────────────────────────────────────────────────────╯');
var fileformat = prompt(':> '); console.log('\n')
fileformat = fileformat.toLowerCase()
}while( fileformat !== '.mp3' && fileformat !== 'mp3' && fileformat !== '.aac' && fileformat !== '.mp4' && fileformat !== 'mp4' && fileformat !== 'aac' && fileformat !== 'mkv' && fileformat !== '.mkv')
let sidechoices;
console.log(fileformat)
if(fileformat === 'mkv'){fileformat = '.mkv'}
if(fileformat === 'aac') fileformat = '.aac'; sidechoices = 'enable-AAC';*/
/*function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
const clearLastLine = () => {
process.stdout.moveCursor(0, -1) // up one line
process.stdout.clearLine(1) // from cursor to end
}
function lobby(){
console.clear();
console.log('\x1b[34m _|_| _| _| _|_|_|_| _|_|_| _|_|_| _|_|_| _|_| _| _| _|_|_| _|_|_|_|_|\n_| _| _| _| _| _| _| _| _| _| _| _| _| _|_| _|_| _| _| _| \n_| _| _| _| _|_|_| _|_|_| _|_|_| _|_|_| _| _| _| _| _| _|_|_| _| \n_| _| _| _| _| _| _| _| _| _| _| _| _| _| _| _| \n _|_| _| _|_|_|_| _| _| _| _| _| _|_| _| _| _| _| \x1b[0m \n');
process.stdout.write(`\x1b[31m ════════════════════════════════════╣ YOUTUBE MEDIA DOWNLOADER ╠════════════════════════════════════ \x1b[0m`);
var bar = '';
var spaces = '';
setInterval(bars, 2000)
async function bars(){
for (let i = 0; i < 36; i++) {
await sleep(20)
bar += '═';
spaces = Array(36 - i).join(' ');
process.stdout.clearLine(); // Clear the previous line
process.stdout.cursorTo(0); // Move the cursor to the beginning of the line
process.stdout.write(`\x1b[31m ${bar}${spaces}╣ YOUTUBE MEDIA DOWNLOADER ╠${spaces}${bar} \x1b[0m`);
if(i === 35){bar = ''; spaces = ''}
}
}
/*path = __dirname + '/connectionwarning.json'
var json = fs.readFileSync(path)
var object = JSON.parse(json)
if(object.stability === "slowed"){
console.log('\n╭─────────────────────────────────────────────────────────────────────────────────────╮')
console.log('| 🌐 Service quality may be poorly affected due to the client\'s connection speed │')
console.log('╰─────────────────────────────────────────────────────────────────────────────────────╯');
}*/
//path = __dirname + '/downlog.txt'
/*try{
const file = readline.createInterface({
input: fs.createReadStream(path),
output: process.stdout,
terminal: false
})
file.on('line', (line) => {
console.log('\x1b[32m',line, '\x1b[0m')
})}catch(e){
}*/
/*}
lobby()*/
const ytpl = require('ytpl')
const ytdl = require('ytdl-core')
let link = "https://www.youtube.com/playlist?list=PL5OQUkTRJ6cK1TYTbEHDdSV3itjmIqu1_"
ytpl(link).then(infor => {
console.log(infor)
})