-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathcli.js
58 lines (47 loc) · 1.75 KB
/
cli.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
// import from npo-dl.js
import { getEpisode } from "./npo-dl.js";
import { Command } from "commander";
import { downloadFromID } from "./download.js";
import process from "node:process";
//enter the npo start show name and download all episodes from all seasons.
//second parameter = season count (0 = all)
//third parameter = reverse seasons (false = Start from latest, true = Start from first)
// getAllEpisodesFromShow("https://npo.nl/start/serie/keuringsdienst-van-waarde").then((urls) => {
// getEpisodes(urls).then((result) => {
// console.log(result);
// });
// });
// enter the npo start show name and download all episodes from the chosen season.
/*
getAllEpisodesFromSeason("keuringsdienst-van-waarde", "seizoen-3").then((urls) => {
getEpisodes(urls);
});
*/
/*
enter the video id here, you can find it in the url of the video, full url should look like this: https://www.npostart.nl/AT_300003151
if the video ids are sequential you can use the second parameter to download multiple episodes
*/
// getEpisodesInOrder("AT_300003161", 1).then((result) => {
// console.log(result);
// });
// getEpisode("https://npo.nl/start/serie/blauw/seizoen-1/blauw_9/afspelen").then((result) => {
// console.log(result);
// });
// simple cli
const program = new Command();
program
.name("npo-start-downloader")
.description("CLI to download npo start episodes")
.version("1.0.0");
async function download(url) {
const information = await getEpisode(url);
const result = await downloadFromID(information);
console.log(result);
}
program.command("download")
.description("download a single episode")
.argument("<url>", "url of the episode")
.action(async (url) => {
await download(url);
});
await program.parseAsync(process.argv);