ani-cli-npm 2.1.4 → 2.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.idea/ani-cli-npm.iml +11 -11
- package/.idea/discord.xml +6 -6
- package/.idea/git_toolbox_prj.xml +15 -0
- package/.idea/inspectionProfiles/Project_Default.xml +10 -0
- package/.idea/jsLibraryMappings.xml +5 -5
- package/.idea/modules.xml +7 -7
- package/.idea/vcs.xml +5 -5
- package/README.MD +79 -77
- package/bin/Anime.js +409 -393
- package/bin/IO/help.js +59 -0
- package/bin/IO/input.js +89 -0
- package/bin/cache.js +79 -0
- package/bin/change_config.js +99 -0
- package/bin/core_utils/curl.js +35 -35
- package/bin/core_utils/interfaces.js +2 -2
- package/bin/core_utils/libs.js +12 -12
- package/bin/core_utils/regex.js +8 -8
- package/bin/cover_manager.js +3 -0
- package/bin/curl.js +35 -0
- package/bin/download.js +36 -36
- package/bin/file_managment/cache.js +87 -87
- package/bin/file_managment/change_config.js +122 -121
- package/bin/file_managment/load_config.js +111 -110
- package/bin/generate_link.js +47 -47
- package/bin/help.js +59 -59
- package/bin/index.js +164 -159
- package/bin/input.js +89 -89
- package/bin/interfaces.js +2 -0
- package/bin/libs.js +12 -0
- package/bin/load_config.js +106 -0
- package/bin/regex.js +8 -0
- package/bin/search_anime.js +39 -39
- package/bin/url_genoration/generate_link.js +47 -0
- package/bin/url_genoration/search_anime.js +39 -0
- package/bin/video_quality.js +6 -0
- package/package.json +45 -45
- package/src/Anime.ts +427 -0
- package/src/IO/help.ts +64 -0
- package/src/IO/input.ts +92 -0
- package/src/core_utils/curl.ts +32 -0
- package/src/core_utils/interfaces.ts +25 -0
- package/src/core_utils/libs.ts +13 -0
- package/src/core_utils/regex.ts +5 -0
- package/src/cover_manager.ts +9 -0
- package/src/download.ts +35 -0
- package/src/file_managment/cache.ts +58 -0
- package/src/file_managment/change_config.ts +126 -0
- package/src/file_managment/load_config.ts +79 -0
- package/src/index.ts +143 -0
- package/src/url_genoration/generate_link.ts +53 -0
- package/src/url_genoration/search_anime.ts +41 -0
- package/src/video_quality.ts +6 -0
- package/temp.sh +676 -0
- package/tsconfig.json +109 -109
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/libs.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Random functions
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.range = void 0;
|
|
5
|
+
function range(start, end) {
|
|
6
|
+
let ans = [];
|
|
7
|
+
for (let i = start; i <= end; i++) {
|
|
8
|
+
ans.push(i);
|
|
9
|
+
}
|
|
10
|
+
return ans;
|
|
11
|
+
}
|
|
12
|
+
exports.range = range;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.make_config_dir = exports.write_config = exports.load_config = void 0;
|
|
27
|
+
const fs = __importStar(require("fs"));
|
|
28
|
+
function make_config_dir(cache_dir, debug) {
|
|
29
|
+
try {
|
|
30
|
+
if (!fs.existsSync(cache_dir + "/"))
|
|
31
|
+
fs.mkdirSync(cache_dir + "/");
|
|
32
|
+
}
|
|
33
|
+
catch {
|
|
34
|
+
if (debug) {
|
|
35
|
+
console.log("Failed to make cache dir");
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.make_config_dir = make_config_dir;
|
|
40
|
+
function write_config(cache_dir, config) {
|
|
41
|
+
try {
|
|
42
|
+
//make_config_dir(cache_dir, config.debug_mode)
|
|
43
|
+
fs.writeFileSync(cache_dir + "/config.conf", JSON.stringify(config), "utf-8");
|
|
44
|
+
}
|
|
45
|
+
catch {
|
|
46
|
+
console.log(("Failed to write to config file."));
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
exports.write_config = write_config;
|
|
50
|
+
function load_config(cache_dir) {
|
|
51
|
+
let config = {
|
|
52
|
+
player: "BROWSER",
|
|
53
|
+
proxy: "",
|
|
54
|
+
user_agent: "Mozilla/5.0 (X11; Linux x86_64; rv:99.0) Gecko/20100101 Firefox/100.0",
|
|
55
|
+
most_recent: {
|
|
56
|
+
episode_number: 0,
|
|
57
|
+
anime_id: ""
|
|
58
|
+
},
|
|
59
|
+
download_folder: ".",
|
|
60
|
+
debug_mode: false,
|
|
61
|
+
mpv_socket_path: "",
|
|
62
|
+
vlc_socket: 0,
|
|
63
|
+
vlc_pass: "",
|
|
64
|
+
w2g_api_key: ""
|
|
65
|
+
};
|
|
66
|
+
if (fs.existsSync(cache_dir + "/config.conf")) {
|
|
67
|
+
// @ts-ignore
|
|
68
|
+
let tmp = JSON.parse(fs.readFileSync(cache_dir + "/config.conf"), "utf8");
|
|
69
|
+
// @ts-ignore
|
|
70
|
+
if (tmp.player !== undefined)
|
|
71
|
+
config.player = tmp.player;
|
|
72
|
+
// @ts-ignore
|
|
73
|
+
if (tmp.proxy !== undefined)
|
|
74
|
+
config.proxy = tmp.proxy;
|
|
75
|
+
// @ts-ignore
|
|
76
|
+
if (tmp.user_agent !== undefined)
|
|
77
|
+
config.user_agent = tmp.user_agent;
|
|
78
|
+
// @ts-ignore
|
|
79
|
+
if (tmp.most_recent !== undefined) {
|
|
80
|
+
// @ts-ignore
|
|
81
|
+
if (tmp.most_recent.episode_number !== undefined)
|
|
82
|
+
config.most_recent.episode_number = tmp.most_recent.episode_number;
|
|
83
|
+
// @ts-ignore
|
|
84
|
+
if (tmp.most_recent.anime_id !== undefined)
|
|
85
|
+
config.most_recent.anime_id = tmp.most_recent.anime_id;
|
|
86
|
+
}
|
|
87
|
+
// @ts-ignore
|
|
88
|
+
if (tmp.download_folder !== undefined)
|
|
89
|
+
config.download_folder = tmp.download_folder;
|
|
90
|
+
// @ts-ignore
|
|
91
|
+
if (tmp.mpv_socket_path !== undefined)
|
|
92
|
+
config.mpv_socket_path = tmp.mpv_socket_path;
|
|
93
|
+
// @ts-ignore
|
|
94
|
+
if (tmp.vlc_socket !== undefined)
|
|
95
|
+
config.vlc_socket = tmp.vlc_socket;
|
|
96
|
+
// @ts-ignore
|
|
97
|
+
if (tmp.vlc_pass !== undefined)
|
|
98
|
+
config.vlc_pass = tmp.vlc_pass;
|
|
99
|
+
// @ts-ignore
|
|
100
|
+
if (tmp.w2g_api_key !== undefined)
|
|
101
|
+
config.w2g_api_key = tmp.w2g_api_key;
|
|
102
|
+
}
|
|
103
|
+
write_config(cache_dir, config);
|
|
104
|
+
return config;
|
|
105
|
+
}
|
|
106
|
+
exports.load_config = load_config;
|
package/bin/regex.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RegexParse = void 0;
|
|
4
|
+
function RegexParse(str, rule) {
|
|
5
|
+
let escapeRegex = (str) => str.replace(/([.*+?^=!:${}()|\[\]\/\\])/g, "\\$1");
|
|
6
|
+
return new RegExp("^" + rule.split("*").map(escapeRegex).join(".*") + "$").test(str);
|
|
7
|
+
}
|
|
8
|
+
exports.RegexParse = RegexParse;
|
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;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generate_link = void 0;
|
|
4
|
+
const gogohd_url = "https://gogohd.net/";
|
|
5
|
+
const base_url = "https://animixplay.to";
|
|
6
|
+
const curl_1 = require("../core_utils/curl");
|
|
7
|
+
const regex_1 = require("../core_utils/regex");
|
|
8
|
+
async function generate_link(provider, id, player) {
|
|
9
|
+
let html_ = "";
|
|
10
|
+
let provider_name = "";
|
|
11
|
+
switch (provider) {
|
|
12
|
+
case 1:
|
|
13
|
+
html_ = await (0, curl_1.curl)(`${gogohd_url}streaming.php?id=${id}`);
|
|
14
|
+
provider_name = 'Xstreamcdn';
|
|
15
|
+
console.log(`Fetching ${provider_name} links...`);
|
|
16
|
+
let html = html_.split("\n");
|
|
17
|
+
let fb_id = "";
|
|
18
|
+
for (let x in html) {
|
|
19
|
+
if ((0, regex_1.RegexParse)(html[x], "*<li class=\"linkserver\" data-status=\"1\" data-video=\"https://fembed9hd.com/v/*")) {
|
|
20
|
+
fb_id = html[x].slice(html[x].indexOf("/v/") + 3, html[x].indexOf("\">X"));
|
|
21
|
+
break;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
if (!fb_id) {
|
|
25
|
+
console.log("Error, no fb_id found.");
|
|
26
|
+
return 0;
|
|
27
|
+
}
|
|
28
|
+
//let refr = "https://fembed-hd.com/v/"+fb_id
|
|
29
|
+
let post = await (0, curl_1.curl)("https://fembed-hd.com/api/source/" + fb_id, "POST");
|
|
30
|
+
post = post.slice(post.indexOf(",\"data\":[{\"file\":\"") + 18, post.length);
|
|
31
|
+
post = post.slice(0, post.indexOf("\"")).replaceAll("\\/", "/");
|
|
32
|
+
return post;
|
|
33
|
+
case 2:
|
|
34
|
+
provider_name = 'Animixplay';
|
|
35
|
+
console.log(`Fetching ${provider_name} links...`);
|
|
36
|
+
let buffer = new Buffer(id);
|
|
37
|
+
let enc_id = buffer.toString("base64");
|
|
38
|
+
buffer = new Buffer(id + "LTXs3GrU8we9O" + enc_id);
|
|
39
|
+
let ani_id = buffer.toString("base64");
|
|
40
|
+
buffer = Buffer.from((await (0, curl_1.curl)(`${base_url}/api/live${ani_id}`, "GET", true)).split("#")[1], "base64");
|
|
41
|
+
if (player === "BROWSER") {
|
|
42
|
+
return `${base_url}/api/live${ani_id}`;
|
|
43
|
+
}
|
|
44
|
+
return buffer.toString("utf-8");
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
exports.generate_link = generate_link;
|
|
@@ -0,0 +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("../IO/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.5",
|
|
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
|
+
"typescript": "^4.9.3",
|
|
40
|
+
"w2g-client": "^1.1.0"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@types/node": "^18.11.9"
|
|
44
|
+
}
|
|
45
|
+
}
|