-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
70 lines (58 loc) · 1.95 KB
/
main.js
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
const { getFeed } = require('./lib/cb01/rss.js');
const { getLinks } = require('./lib/cb01/links.js');
const inquirer = require('inquirer');
const { Separator } = require('inquirer');
const { getStreamingLink } = require("./lib/cb01/bypassLinkProtector.js");
(async () => {
const siteLink = await getFeed();
const linksfound = await getLinks(siteLink);
var linkDaRisolvere = [];
if(Array.isArray(linksfound[0].value)){
const scelta = await inquirer.prompt([
{
type: 'checkbox',
name: 'risultato',
message: 'Scegli puntate',
choices: linksfound,
loop: false
},
]);
var linksScelti = [];
scelta.risultato.forEach(element => {
linksScelti.push(...element);
linksScelti.push(new Separator())
});
linksScelti.pop();
const scelta2 = await inquirer.prompt([
{
type: 'checkbox',
name: 'risultato',
message: 'Scegli link puntate',
choices: linksScelti,
loop: false
},
]);
console.log(scelta2.risultato);
linkDaRisolvere = scelta2.risultato;
}else{
const scelta = await inquirer.prompt([
{
type: 'list',
name: 'risultato',
message: 'Scegli link',
choices: linksfound,
loop: false
},
]);
console.log(scelta.risultato);
linkDaRisolvere.push(scelta.risultato);
}
console.log("inizio risoluzione link");
for (var link of linkDaRisolvere) {
var linkRisolto = await getStreamingLink(link); // da try catch e implementare gestione link multipli
console.log(linkRisolto);
}
process.stdin.setRawMode(true);
process.stdin.resume();
process.stdin.on('data', process.exit.bind(process, 0));
})();