ani-cli-npm 2.1.2 → 2.1.4
Sign up to get free protection for your applications and to get access to all the features.
- package/.idea/ani-cli-npm.iml +11 -11
- package/.idea/discord.xml +6 -6
- package/.idea/jsLibraryMappings.xml +5 -5
- package/.idea/modules.xml +7 -7
- package/.idea/vcs.xml +5 -5
- package/README.MD +77 -77
- package/bin/Anime.js +393 -322
- package/bin/core_utils/curl.js +35 -35
- package/bin/{interfaces.js → core_utils/interfaces.js} +2 -2
- package/bin/core_utils/libs.js +12 -12
- package/bin/core_utils/regex.js +8 -8
- package/bin/download.js +36 -36
- package/bin/file_managment/cache.js +87 -79
- package/bin/file_managment/change_config.js +121 -99
- package/bin/file_managment/load_config.js +110 -110
- package/bin/generate_link.js +47 -47
- package/bin/help.js +59 -59
- package/bin/index.js +159 -119
- package/bin/input.js +89 -89
- package/bin/search_anime.js +39 -39
- package/package.json +45 -45
- package/tsconfig.json +109 -109
- package/.idea/git_toolbox_prj.xml +0 -15
- package/.idea/inspectionProfiles/Project_Default.xml +0 -10
- package/bin/cache.js +0 -79
- package/bin/change_config.js +0 -99
- package/bin/curl.js +0 -35
- package/bin/libs.js +0 -12
- package/bin/load_config.js +0 -106
- package/bin/regex.js +0 -8
- package/bin/video_quality.js +0 -6
package/bin/index.js
CHANGED
@@ -1,119 +1,159 @@
|
|
1
|
-
#!/usr/bin/env node
|
2
|
-
"use strict";
|
3
|
-
var
|
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
|
-
|
1
|
+
#!/usr/bin/env node
|
2
|
+
"use strict";
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
4
|
+
if (k2 === undefined) k2 = k;
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
8
|
+
}
|
9
|
+
Object.defineProperty(o, k2, desc);
|
10
|
+
}) : (function(o, m, k, k2) {
|
11
|
+
if (k2 === undefined) k2 = k;
|
12
|
+
o[k2] = m[k];
|
13
|
+
}));
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
16
|
+
}) : function(o, v) {
|
17
|
+
o["default"] = v;
|
18
|
+
});
|
19
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
20
|
+
if (mod && mod.__esModule) return mod;
|
21
|
+
var result = {};
|
22
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
23
|
+
__setModuleDefault(result, mod);
|
24
|
+
return result;
|
25
|
+
};
|
26
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
27
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
28
|
+
};
|
29
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
30
|
+
const process = __importStar(require("process"));
|
31
|
+
//process.removeAllListeners() // Ignore warning
|
32
|
+
// External
|
33
|
+
const appdata_path_1 = __importDefault(require("appdata-path"));
|
34
|
+
const chalk = require("chalk");
|
35
|
+
// Internal
|
36
|
+
const Anime_1 = require("./Anime");
|
37
|
+
const search_anime_1 = require("./search_anime");
|
38
|
+
const load_config_1 = require("./file_managment/load_config");
|
39
|
+
const input_1 = require("./input");
|
40
|
+
const change_config_1 = require("./file_managment/change_config");
|
41
|
+
const cache_1 = require("./file_managment/cache");
|
42
|
+
const download_1 = require("./download");
|
43
|
+
const help_1 = require("./help");
|
44
|
+
const app_data_folder = (0, appdata_path_1.default)();
|
45
|
+
const cache_folder = app_data_folder + "/ani-cli-npm";
|
46
|
+
(0, load_config_1.make_config_dir)(cache_folder, true);
|
47
|
+
console.clear();
|
48
|
+
async function main() {
|
49
|
+
let config = (0, load_config_1.load_config)(cache_folder);
|
50
|
+
console.log(chalk.magenta("Ani-cli-npm!\n"));
|
51
|
+
if (config.most_recent.anime_id !== "") {
|
52
|
+
console.log(chalk.grey(`Most recently played: ${config.most_recent.anime_id} episode ${config.most_recent.episode_number + 1}\n`));
|
53
|
+
}
|
54
|
+
let choice = await (0, input_1.selection)([
|
55
|
+
"Search",
|
56
|
+
"Continue",
|
57
|
+
"Download",
|
58
|
+
"Option",
|
59
|
+
"Clear cache",
|
60
|
+
"Help",
|
61
|
+
"Quit",
|
62
|
+
], ["s", "c", "d", "o", " ", "h", "q"], ((thing) => { return chalk.magenta(thing); }), ((thing) => { return chalk.magenta(thing); }));
|
63
|
+
switch (choice) {
|
64
|
+
case 0: // Search
|
65
|
+
let temp_ = await (0, search_anime_1.search)();
|
66
|
+
if (temp_ == 1) {
|
67
|
+
await main();
|
68
|
+
process.exit();
|
69
|
+
}
|
70
|
+
let anime_id = temp_;
|
71
|
+
let anime = new Anime_1.Anime();
|
72
|
+
await anime.init(anime_id, cache_folder);
|
73
|
+
let episode_number;
|
74
|
+
if (anime.episode_list.length == 1) {
|
75
|
+
episode_number = 1;
|
76
|
+
}
|
77
|
+
else {
|
78
|
+
console.log(`Select episode [1-${anime.episode_list.length}] ${(anime.most_recent != 0) ? `Or C to continue from ep${anime.most_recent + 1}` : ""}`);
|
79
|
+
episode_number = await (0, input_1.number_input)(anime.episode_list.length, 1, (anime.most_recent != 0) ? ["c"] : [], (anime.most_recent != 0) ? [anime.most_recent + 1] : []);
|
80
|
+
}
|
81
|
+
await anime.play_head(episode_number - 1, config, cache_folder);
|
82
|
+
if (anime.player.hasOwnProperty("quit")) {
|
83
|
+
await anime.player.player.quit();
|
84
|
+
}
|
85
|
+
await main();
|
86
|
+
break;
|
87
|
+
case 1: // Continue
|
88
|
+
if (config.most_recent.anime_id == "") {
|
89
|
+
console.clear();
|
90
|
+
console.log(chalk.red("No episode played recently"));
|
91
|
+
await main();
|
92
|
+
break;
|
93
|
+
}
|
94
|
+
let continue_anime = new Anime_1.Anime();
|
95
|
+
await continue_anime.init(config.most_recent.anime_id, cache_folder);
|
96
|
+
await continue_anime.play_head(config.most_recent.episode_number, config, cache_folder);
|
97
|
+
try {
|
98
|
+
await continue_anime.player.player.quit();
|
99
|
+
}
|
100
|
+
catch { }
|
101
|
+
await main();
|
102
|
+
break;
|
103
|
+
case 2: // Download
|
104
|
+
let code = await (0, download_1.download)(cache_folder, config);
|
105
|
+
if (code == 1) {
|
106
|
+
console.log(chalk.red("Error downloading episodes"));
|
107
|
+
}
|
108
|
+
break;
|
109
|
+
case 3: // Options
|
110
|
+
let temp = structuredClone(config);
|
111
|
+
let exit_code;
|
112
|
+
while (true) {
|
113
|
+
// @ts-ignore
|
114
|
+
temp, exit_code = await (0, change_config_1.config_)(temp);
|
115
|
+
if (exit_code === 1) {
|
116
|
+
config = temp;
|
117
|
+
//proxyAgent = new HttpsProxyAgent(config.proxy);
|
118
|
+
console.clear();
|
119
|
+
try {
|
120
|
+
(0, load_config_1.write_config)(cache_folder, config);
|
121
|
+
console.log(chalk.yellow("Config changed."));
|
122
|
+
}
|
123
|
+
catch {
|
124
|
+
console.log(chalk.red("Error writing to .conf file."));
|
125
|
+
}
|
126
|
+
break;
|
127
|
+
}
|
128
|
+
else if (exit_code === 2) {
|
129
|
+
temp = config;
|
130
|
+
console.clear();
|
131
|
+
console.log(chalk.yellow("Config changes disregarded."));
|
132
|
+
break;
|
133
|
+
}
|
134
|
+
}
|
135
|
+
await main();
|
136
|
+
break;
|
137
|
+
case 4:
|
138
|
+
console.clear();
|
139
|
+
console.log(chalk.yellow("Warning, this will also clear your current position in each anime, are you sure you want to do this?"));
|
140
|
+
if (await (0, input_1.selection)(["yes", "no"], ["y", "n"]) == 0) {
|
141
|
+
await (0, cache_1.clear_cache)(cache_folder);
|
142
|
+
console.clear();
|
143
|
+
console.log(chalk.grey("Cache cleared"));
|
144
|
+
}
|
145
|
+
else {
|
146
|
+
console.clear();
|
147
|
+
}
|
148
|
+
await main();
|
149
|
+
break;
|
150
|
+
case 5:
|
151
|
+
await (0, help_1.help)();
|
152
|
+
break;
|
153
|
+
case 6: // Quit
|
154
|
+
console.log("Exit");
|
155
|
+
}
|
156
|
+
return 0;
|
157
|
+
// await search()
|
158
|
+
}
|
159
|
+
main();
|
package/bin/input.js
CHANGED
@@ -1,89 +1,89 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
-
};
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
exports.number_input = exports.input = exports.selection = void 0;
|
7
|
-
const chalk_1 = __importDefault(require("chalk"));
|
8
|
-
const _prompt = require("simple-input");
|
9
|
-
async function selection(options, extra_options = [], color1 = ((thing) => { return chalk_1.default.yellow(thing); }), color2 = ((thing) => { return chalk_1.default.green(thing); }), overwrite = false) {
|
10
|
-
/*
|
11
|
-
selection(options, extra_options, color1, color2)
|
12
|
-
|
13
|
-
Gives use prompt to choose from a list of options. Either by inputting a number ranging from 1, to the length of the list. Or by inputting a letter (non-caps-sensitive) relating to the option.
|
14
|
-
|
15
|
-
|
16
|
-
- options: array of options; e.g. ["play", "download", "continue", "quit"] REQUIRED
|
17
|
-
|
18
|
-
|
19
|
-
- extra_options: array of characters as alternatives to numbers (both will be displayed). e.g. ["p", "d", "c", "q"].
|
20
|
-
|
21
|
-
default: []
|
22
|
-
|
23
|
-
- color1 and color2: functions that will dictate what 2 colors the options with alternate between (option1 will be color1, option2;color2, option3;color1, etc).
|
24
|
-
recommended for this function to return a chalk.____() parsed string.
|
25
|
-
|
26
|
-
default: ((thing:string) => {return chalk.yellow(thing)}) and ((thing:string) => {return chalk.green(thing)})
|
27
|
-
|
28
|
-
- Overwrite: boolean. Please dont use this. I should not be using it. It prints out the raw string instead of adding numbers to them to allow for bogus.
|
29
|
-
*/
|
30
|
-
let color = true;
|
31
|
-
for (let x in options) {
|
32
|
-
if (!overwrite) {
|
33
|
-
if (color) {
|
34
|
-
console.log(color1((parseInt(x) + 1).toString() +
|
35
|
-
((extra_options[x] == undefined) ? "" : "/" + extra_options[x]) +
|
36
|
-
") " + options[x].replaceAll("-", " ")));
|
37
|
-
}
|
38
|
-
else {
|
39
|
-
console.log(color2((parseInt(x) + 1).toString() +
|
40
|
-
((extra_options[x] == undefined) ? "" : "/" + extra_options[x]) +
|
41
|
-
") " + options[x].replaceAll("-", " ")));
|
42
|
-
}
|
43
|
-
}
|
44
|
-
else {
|
45
|
-
console.log(options[x]);
|
46
|
-
}
|
47
|
-
color = !color;
|
48
|
-
}
|
49
|
-
let input = "";
|
50
|
-
do {
|
51
|
-
// @ts-ignore
|
52
|
-
input = (await _prompt(">")).toLowerCase();
|
53
|
-
for (let x in extra_options) {
|
54
|
-
if (extra_options[x].toLowerCase() == input) {
|
55
|
-
input = (parseInt(x) + 1).toString();
|
56
|
-
}
|
57
|
-
}
|
58
|
-
if (!(1 <= parseInt(input) && parseInt(input) <= options.length)) {
|
59
|
-
console.log(chalk_1.default.red("Invalid choice."));
|
60
|
-
}
|
61
|
-
} while (!(1 <= parseInt(input) && parseInt(input) <= options.length));
|
62
|
-
return parseInt(input) - 1;
|
63
|
-
}
|
64
|
-
exports.selection = selection;
|
65
|
-
async function input() {
|
66
|
-
return await _prompt(">");
|
67
|
-
}
|
68
|
-
exports.input = input;
|
69
|
-
async function number_input(max, min = 1, extra_options = [], extra_option_values = []) {
|
70
|
-
let selector;
|
71
|
-
let selection;
|
72
|
-
do {
|
73
|
-
selector = await _prompt(">");
|
74
|
-
if (extra_options.includes(selector.toLowerCase())) {
|
75
|
-
selection = extra_option_values[extra_options.indexOf(selector)];
|
76
|
-
}
|
77
|
-
else {
|
78
|
-
selection = parseInt(selector);
|
79
|
-
}
|
80
|
-
if (selector == "") {
|
81
|
-
selection = min;
|
82
|
-
}
|
83
|
-
if (!(min <= selection && selection <= max)) {
|
84
|
-
console.log(chalk_1.default.red("Invalid choice."));
|
85
|
-
}
|
86
|
-
} while (!(min <= selection && selection <= max));
|
87
|
-
return selection;
|
88
|
-
}
|
89
|
-
exports.number_input = number_input;
|
1
|
+
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
exports.number_input = exports.input = exports.selection = void 0;
|
7
|
+
const chalk_1 = __importDefault(require("chalk"));
|
8
|
+
const _prompt = require("simple-input");
|
9
|
+
async function selection(options, extra_options = [], color1 = ((thing) => { return chalk_1.default.yellow(thing); }), color2 = ((thing) => { return chalk_1.default.green(thing); }), overwrite = false) {
|
10
|
+
/*
|
11
|
+
selection(options, extra_options, color1, color2)
|
12
|
+
|
13
|
+
Gives use prompt to choose from a list of options. Either by inputting a number ranging from 1, to the length of the list. Or by inputting a letter (non-caps-sensitive) relating to the option.
|
14
|
+
|
15
|
+
|
16
|
+
- options: array of options; e.g. ["play", "download", "continue", "quit"] REQUIRED
|
17
|
+
|
18
|
+
|
19
|
+
- extra_options: array of characters as alternatives to numbers (both will be displayed). e.g. ["p", "d", "c", "q"].
|
20
|
+
|
21
|
+
default: []
|
22
|
+
|
23
|
+
- color1 and color2: functions that will dictate what 2 colors the options with alternate between (option1 will be color1, option2;color2, option3;color1, etc).
|
24
|
+
recommended for this function to return a chalk.____() parsed string.
|
25
|
+
|
26
|
+
default: ((thing:string) => {return chalk.yellow(thing)}) and ((thing:string) => {return chalk.green(thing)})
|
27
|
+
|
28
|
+
- Overwrite: boolean. Please dont use this. I should not be using it. It prints out the raw string instead of adding numbers to them to allow for bogus.
|
29
|
+
*/
|
30
|
+
let color = true;
|
31
|
+
for (let x in options) {
|
32
|
+
if (!overwrite) {
|
33
|
+
if (color) {
|
34
|
+
console.log(color1((parseInt(x) + 1).toString() +
|
35
|
+
((extra_options[x] == undefined) ? "" : "/" + extra_options[x]) +
|
36
|
+
") " + options[x].replaceAll("-", " ")));
|
37
|
+
}
|
38
|
+
else {
|
39
|
+
console.log(color2((parseInt(x) + 1).toString() +
|
40
|
+
((extra_options[x] == undefined) ? "" : "/" + extra_options[x]) +
|
41
|
+
") " + options[x].replaceAll("-", " ")));
|
42
|
+
}
|
43
|
+
}
|
44
|
+
else {
|
45
|
+
console.log(options[x]);
|
46
|
+
}
|
47
|
+
color = !color;
|
48
|
+
}
|
49
|
+
let input = "";
|
50
|
+
do {
|
51
|
+
// @ts-ignore
|
52
|
+
input = (await _prompt(">")).toLowerCase();
|
53
|
+
for (let x in extra_options) {
|
54
|
+
if (extra_options[x].toLowerCase() == input) {
|
55
|
+
input = (parseInt(x) + 1).toString();
|
56
|
+
}
|
57
|
+
}
|
58
|
+
if (!(1 <= parseInt(input) && parseInt(input) <= options.length)) {
|
59
|
+
console.log(chalk_1.default.red("Invalid choice."));
|
60
|
+
}
|
61
|
+
} while (!(1 <= parseInt(input) && parseInt(input) <= options.length));
|
62
|
+
return parseInt(input) - 1;
|
63
|
+
}
|
64
|
+
exports.selection = selection;
|
65
|
+
async function input() {
|
66
|
+
return await _prompt(">");
|
67
|
+
}
|
68
|
+
exports.input = input;
|
69
|
+
async function number_input(max, min = 1, extra_options = [], extra_option_values = []) {
|
70
|
+
let selector;
|
71
|
+
let selection;
|
72
|
+
do {
|
73
|
+
selector = await _prompt(">");
|
74
|
+
if (extra_options.includes(selector.toLowerCase())) {
|
75
|
+
selection = extra_option_values[extra_options.indexOf(selector)];
|
76
|
+
}
|
77
|
+
else {
|
78
|
+
selection = parseInt(selector);
|
79
|
+
}
|
80
|
+
if (selector == "") {
|
81
|
+
selection = min;
|
82
|
+
}
|
83
|
+
if (!(min <= selection && selection <= max)) {
|
84
|
+
console.log(chalk_1.default.red("Invalid choice."));
|
85
|
+
}
|
86
|
+
} while (!(min <= selection && selection <= max));
|
87
|
+
return selection;
|
88
|
+
}
|
89
|
+
exports.number_input = number_input;
|
package/bin/search_anime.js
CHANGED
@@ -1,39 +1,39 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
-
};
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
exports.search = void 0;
|
7
|
-
const regex_1 = require("./core_utils/regex");
|
8
|
-
const curl_1 = require("./core_utils/curl");
|
9
|
-
const input_1 = require("./input");
|
10
|
-
const chalk_1 = __importDefault(require("chalk"));
|
11
|
-
async function search_anime(search) {
|
12
|
-
let filter = "*<ahref=\"/category/*\"title=\"*\">";
|
13
|
-
let html = (await (0, curl_1.curl)("https://gogoanime.dk//search.html?keyword=" + search)).split("\n");
|
14
|
-
let lines = [];
|
15
|
-
for (let x in html) {
|
16
|
-
html[x] = html[x].replaceAll(/ /g, '').replaceAll(/\t/g, '');
|
17
|
-
if ((0, regex_1.RegexParse)(html[x], filter)) {
|
18
|
-
html[x] = html[x].slice(html[x].indexOf("/category/") + 10);
|
19
|
-
html[x] = html[x].slice(0, html[x].indexOf("\"title="));
|
20
|
-
lines.push(html[x]);
|
21
|
-
}
|
22
|
-
}
|
23
|
-
if (!lines[0]) {
|
24
|
-
lines.pop();
|
25
|
-
}
|
26
|
-
return lines;
|
27
|
-
}
|
28
|
-
async function search() {
|
29
|
-
console.clear();
|
30
|
-
console.log(chalk_1.default.magenta("Search..."));
|
31
|
-
let _selection = await (0, input_1.input)();
|
32
|
-
let results = await search_anime(_selection);
|
33
|
-
if (results[0] === undefined) {
|
34
|
-
console.log(chalk_1.default.red("No results found."));
|
35
|
-
return 1;
|
36
|
-
}
|
37
|
-
return results[await (0, input_1.selection)(results)];
|
38
|
-
}
|
39
|
-
exports.search = search;
|
1
|
+
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
exports.search = void 0;
|
7
|
+
const regex_1 = require("./core_utils/regex");
|
8
|
+
const curl_1 = require("./core_utils/curl");
|
9
|
+
const input_1 = require("./input");
|
10
|
+
const chalk_1 = __importDefault(require("chalk"));
|
11
|
+
async function search_anime(search) {
|
12
|
+
let filter = "*<ahref=\"/category/*\"title=\"*\">";
|
13
|
+
let html = (await (0, curl_1.curl)("https://gogoanime.dk//search.html?keyword=" + search)).split("\n");
|
14
|
+
let lines = [];
|
15
|
+
for (let x in html) {
|
16
|
+
html[x] = html[x].replaceAll(/ /g, '').replaceAll(/\t/g, '');
|
17
|
+
if ((0, regex_1.RegexParse)(html[x], filter)) {
|
18
|
+
html[x] = html[x].slice(html[x].indexOf("/category/") + 10);
|
19
|
+
html[x] = html[x].slice(0, html[x].indexOf("\"title="));
|
20
|
+
lines.push(html[x]);
|
21
|
+
}
|
22
|
+
}
|
23
|
+
if (!lines[0]) {
|
24
|
+
lines.pop();
|
25
|
+
}
|
26
|
+
return lines;
|
27
|
+
}
|
28
|
+
async function search() {
|
29
|
+
console.clear();
|
30
|
+
console.log(chalk_1.default.magenta("Search..."));
|
31
|
+
let _selection = await (0, input_1.input)();
|
32
|
+
let results = await search_anime(_selection);
|
33
|
+
if (results[0] === undefined) {
|
34
|
+
console.log(chalk_1.default.red("No results found."));
|
35
|
+
return 1;
|
36
|
+
}
|
37
|
+
return results[await (0, input_1.selection)(results)];
|
38
|
+
}
|
39
|
+
exports.search = search;
|
package/package.json
CHANGED
@@ -1,45 +1,45 @@
|
|
1
|
-
{
|
2
|
-
"name": "ani-cli-npm",
|
3
|
-
"version": "2.1.
|
4
|
-
"description": "ani-cli tool rewritten as npm package",
|
5
|
-
"main": "bin/index.js",
|
6
|
-
"scripts": {
|
7
|
-
"build": "tsc",
|
8
|
-
"start": "node bin/index.js"
|
9
|
-
},
|
10
|
-
"repository": {
|
11
|
-
"type": "git",
|
12
|
-
"url": "https://github.com/Bumpkin-Pi/ani-cli-npm"
|
13
|
-
},
|
14
|
-
"homepage": "https://github.com/Bumpkin-Pi/ani-cli-npm",
|
15
|
-
"keywords": [
|
16
|
-
"anime",
|
17
|
-
"ani-cli",
|
18
|
-
"anime",
|
19
|
-
"client",
|
20
|
-
"weeb",
|
21
|
-
"sad-weeb",
|
22
|
-
"video",
|
23
|
-
"download"
|
24
|
-
],
|
25
|
-
"author": "bumpkin-pi",
|
26
|
-
"license": "ISC",
|
27
|
-
"bin": {
|
28
|
-
"ani-cli-npm": "/bin/index.js"
|
29
|
-
},
|
30
|
-
"dependencies": {
|
31
|
-
"@types/node-fetch": "^2.6.2",
|
32
|
-
"appdata-path": "^1.0.0",
|
33
|
-
"chalk": "^4.1.0",
|
34
|
-
"download-file-with-progressbar": "^1.2.3",
|
35
|
-
"media-player-controller": "^1.5.3",
|
36
|
-
"node-fetch": "^2.6.6",
|
37
|
-
"open": "^8.4.0",
|
38
|
-
"simple-input": "^1.0.1",
|
39
|
-
"
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
"
|
44
|
-
}
|
45
|
-
}
|
1
|
+
{
|
2
|
+
"name": "ani-cli-npm",
|
3
|
+
"version": "2.1.4",
|
4
|
+
"description": "ani-cli tool rewritten as npm package",
|
5
|
+
"main": "bin/index.js",
|
6
|
+
"scripts": {
|
7
|
+
"build": "tsc",
|
8
|
+
"start": "node bin/index.js"
|
9
|
+
},
|
10
|
+
"repository": {
|
11
|
+
"type": "git",
|
12
|
+
"url": "https://github.com/Bumpkin-Pi/ani-cli-npm"
|
13
|
+
},
|
14
|
+
"homepage": "https://github.com/Bumpkin-Pi/ani-cli-npm",
|
15
|
+
"keywords": [
|
16
|
+
"anime",
|
17
|
+
"ani-cli",
|
18
|
+
"anime",
|
19
|
+
"client",
|
20
|
+
"weeb",
|
21
|
+
"sad-weeb",
|
22
|
+
"video",
|
23
|
+
"download"
|
24
|
+
],
|
25
|
+
"author": "bumpkin-pi",
|
26
|
+
"license": "ISC",
|
27
|
+
"bin": {
|
28
|
+
"ani-cli-npm": "/bin/index.js"
|
29
|
+
},
|
30
|
+
"dependencies": {
|
31
|
+
"@types/node-fetch": "^2.6.2",
|
32
|
+
"appdata-path": "^1.0.0",
|
33
|
+
"chalk": "^4.1.0",
|
34
|
+
"download-file-with-progressbar": "^1.2.3",
|
35
|
+
"media-player-controller": "^1.5.3",
|
36
|
+
"node-fetch": "^2.6.6",
|
37
|
+
"open": "^8.4.0",
|
38
|
+
"simple-input": "^1.0.1",
|
39
|
+
"w2g-client": "^1.1.0"
|
40
|
+
},
|
41
|
+
"devDependencies": {
|
42
|
+
"@types/node": "^18.11.9",
|
43
|
+
"typescript": "^4.9.4"
|
44
|
+
}
|
45
|
+
}
|