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.
@@ -1,110 +1,110 @@
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
- episode_second: 0,
58
- anime_id: ""
59
- },
60
- download_folder: ".",
61
- debug_mode: false,
62
- mpv_socket_path: "",
63
- vlc_socket: 0,
64
- vlc_pass: "",
65
- w2g_api_key: ""
66
- };
67
- if (fs.existsSync(cache_dir + "/config.conf")) {
68
- // @ts-ignore
69
- let tmp = JSON.parse(fs.readFileSync(cache_dir + "/config.conf"), "utf8");
70
- // @ts-ignore
71
- if (tmp.player !== undefined)
72
- config.player = tmp.player;
73
- // @ts-ignore
74
- if (tmp.proxy !== undefined)
75
- config.proxy = tmp.proxy;
76
- // @ts-ignore
77
- if (tmp.user_agent !== undefined)
78
- config.user_agent = tmp.user_agent;
79
- // @ts-ignore
80
- if (tmp.most_recent !== undefined) {
81
- // @ts-ignore
82
- if (tmp.most_recent.episode_number !== undefined)
83
- config.most_recent.episode_number = tmp.most_recent.episode_number;
84
- // @ts-ignore
85
- if (tmp.most_recent.anime_id !== undefined)
86
- config.most_recent.anime_id = tmp.most_recent.anime_id;
87
- // @ts-ignore
88
- if (tmp.most_recent.episode_second !== undefined)
89
- config.most_recent.episode_second = tmp.most_recent.episode_second;
90
- }
91
- // @ts-ignore
92
- if (tmp.download_folder !== undefined)
93
- config.download_folder = tmp.download_folder;
94
- // @ts-ignore
95
- if (tmp.mpv_socket_path !== undefined)
96
- config.mpv_socket_path = tmp.mpv_socket_path;
97
- // @ts-ignore
98
- if (tmp.vlc_socket !== undefined)
99
- config.vlc_socket = tmp.vlc_socket;
100
- // @ts-ignore
101
- if (tmp.vlc_pass !== undefined)
102
- config.vlc_pass = tmp.vlc_pass;
103
- // @ts-ignore
104
- if (tmp.w2g_api_key !== undefined)
105
- config.w2g_api_key = tmp.w2g_api_key;
106
- }
107
- write_config(cache_dir, config);
108
- return config;
109
- }
110
- exports.load_config = load_config;
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
+ episode_second: 0,
58
+ anime_id: ""
59
+ },
60
+ download_folder: ".",
61
+ debug_mode: false,
62
+ mpv_socket_path: "",
63
+ vlc_socket: 0,
64
+ vlc_pass: "",
65
+ w2g_api_key: ""
66
+ };
67
+ if (fs.existsSync(cache_dir + "/config.conf")) {
68
+ // @ts-ignore
69
+ let tmp = JSON.parse(fs.readFileSync(cache_dir + "/config.conf"), "utf8");
70
+ // @ts-ignore
71
+ if (tmp.player !== undefined)
72
+ config.player = tmp.player;
73
+ // @ts-ignore
74
+ if (tmp.proxy !== undefined)
75
+ config.proxy = tmp.proxy;
76
+ // @ts-ignore
77
+ if (tmp.user_agent !== undefined)
78
+ config.user_agent = tmp.user_agent;
79
+ // @ts-ignore
80
+ if (tmp.most_recent !== undefined) {
81
+ // @ts-ignore
82
+ if (tmp.most_recent.episode_number !== undefined)
83
+ config.most_recent.episode_number = tmp.most_recent.episode_number;
84
+ // @ts-ignore
85
+ if (tmp.most_recent.anime_id !== undefined)
86
+ config.most_recent.anime_id = tmp.most_recent.anime_id;
87
+ // @ts-ignore
88
+ if (tmp.most_recent.episode_second !== undefined)
89
+ config.most_recent.episode_second = tmp.most_recent.episode_second;
90
+ }
91
+ // @ts-ignore
92
+ if (tmp.download_folder !== undefined)
93
+ config.download_folder = tmp.download_folder;
94
+ // @ts-ignore
95
+ if (tmp.mpv_socket_path !== undefined)
96
+ config.mpv_socket_path = tmp.mpv_socket_path;
97
+ // @ts-ignore
98
+ if (tmp.vlc_socket !== undefined)
99
+ config.vlc_socket = tmp.vlc_socket;
100
+ // @ts-ignore
101
+ if (tmp.vlc_pass !== undefined)
102
+ config.vlc_pass = tmp.vlc_pass;
103
+ // @ts-ignore
104
+ if (tmp.w2g_api_key !== undefined)
105
+ config.w2g_api_key = tmp.w2g_api_key;
106
+ }
107
+ write_config(cache_dir, config);
108
+ return config;
109
+ }
110
+ exports.load_config = load_config;
@@ -1,47 +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;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.generate_link = void 0;
4
+ const gogohd_url = "https://gogohd.pro/";
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
+ if (player === "BROWSER") {
41
+ return `${base_url}/api/live${ani_id}`;
42
+ }
43
+ buffer = Buffer.from((await (0, curl_1.curl)(`${base_url}/api/live${ani_id}`, "GET", true)).split("#")[1], "base64");
44
+ return buffer.toString("utf-8");
45
+ }
46
+ }
47
+ exports.generate_link = generate_link;
package/bin/help.js CHANGED
@@ -1,59 +1,59 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.help = void 0;
4
- const input_1 = require("./input");
5
- const chalk = require("chalk");
6
- const helps = [
7
- (async () => {
8
- console.log(chalk.cyan("Playing anime: \n" +
9
- " Search: \n" +
10
- " Search for a show/movie. This will search on gogoanime.dk.\n" +
11
- " Episode selection: \n" +
12
- " Once an anime is selected, select an episode. If there is only 1 episode " +
13
- "(in the case of a movie), the episode will be played automatically.\n" +
14
- " The episode selected will be played in the video player selected in options. Info on video players can be found in options help."));
15
- await help();
16
- return;
17
- }),
18
- (async () => {
19
- console.log(chalk.cyan("Downloading anime: \n" +
20
- " Search: \n" +
21
- " Search for a show/movie. This will search on gogoanime.dk.\n" +
22
- " Episode selection: \n" +
23
- " Once an anime is selected, select a start episode and an end episode. If there is only 1 episode " +
24
- "(in the case of a movie), the episode will be downloaded automatically. Download folder can be changed in options. Default to run location.\n" +
25
- " The selected episodes will be downloaded. It is common for episode links to fail to be fetched, when this happens the episode will be passed, then reattempted in another pass.\n" +
26
- " Episodes sourced from Animixplay links will download m3u8 file, which you will have difficulty playing, if you are able to at all."));
27
- await help();
28
- return;
29
- }),
30
- (async () => {
31
- console.log(chalk.cyan("Options: \n" +
32
- " Player: \n" +
33
- " Player used to play anime.\n" +
34
- " Proxy: \n" +
35
- " https proxy address and port in form ip:port. This is not currently implemented.\n" +
36
- " User agent:\n" +
37
- " node-fetch user agent.\n" +
38
- " Downloads folder:\n" +
39
- " Folder to place downloaded episodes.\n" +
40
- " MPV socket connection file:\n" +
41
- " File for mpv socket, used to control mpv instance with outside tools.\n" +
42
- " VLC socket:\n" +
43
- " VLC http control socket\n" +
44
- " VLC pass:\n" +
45
- " VLC http control password\n" +
46
- " W2G api token:\n" +
47
- " Your user access token for w2g.tv. Can be found at https://w2g.tv/en/account/edit_user under Tools/API\n"));
48
- await help();
49
- return;
50
- }),
51
- (async () => {
52
- return;
53
- })
54
- ];
55
- async function help() {
56
- console.log(chalk.cyan("Help page select: \n"));
57
- return helps[await (0, input_1.selection)(["Playing", "Downloading", "Options", "Quit"], ["p", "d", "o", "q"])]();
58
- }
59
- exports.help = help;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.help = void 0;
4
+ const input_1 = require("./input");
5
+ const chalk = require("chalk");
6
+ const helps = [
7
+ (async () => {
8
+ console.log(chalk.cyan("Playing anime: \n" +
9
+ " Search: \n" +
10
+ " Search for a show/movie. This will search on gogoanime.dk.\n" +
11
+ " Episode selection: \n" +
12
+ " Once an anime is selected, select an episode. If there is only 1 episode " +
13
+ "(in the case of a movie), the episode will be played automatically.\n" +
14
+ " The episode selected will be played in the video player selected in options. Info on video players can be found in options help."));
15
+ await help();
16
+ return;
17
+ }),
18
+ (async () => {
19
+ console.log(chalk.cyan("Downloading anime: \n" +
20
+ " Search: \n" +
21
+ " Search for a show/movie. This will search on gogoanime.dk.\n" +
22
+ " Episode selection: \n" +
23
+ " Once an anime is selected, select a start episode and an end episode. If there is only 1 episode " +
24
+ "(in the case of a movie), the episode will be downloaded automatically. Download folder can be changed in options. Default to run location.\n" +
25
+ " The selected episodes will be downloaded. It is common for episode links to fail to be fetched, when this happens the episode will be passed, then reattempted in another pass.\n" +
26
+ " Episodes sourced from Animixplay links will download m3u8 file, which you will have difficulty playing, if you are able to at all."));
27
+ await help();
28
+ return;
29
+ }),
30
+ (async () => {
31
+ console.log(chalk.cyan("Options: \n" +
32
+ " Player: \n" +
33
+ " Player used to play anime.\n" +
34
+ " Proxy: \n" +
35
+ " https proxy address and port in form ip:port. This is not currently implemented.\n" +
36
+ " User agent:\n" +
37
+ " node-fetch user agent.\n" +
38
+ " Downloads folder:\n" +
39
+ " Folder to place downloaded episodes.\n" +
40
+ " MPV socket connection file:\n" +
41
+ " File for mpv socket, used to control mpv instance with outside tools.\n" +
42
+ " VLC socket:\n" +
43
+ " VLC http control socket\n" +
44
+ " VLC pass:\n" +
45
+ " VLC http control password\n" +
46
+ " W2G api token:\n" +
47
+ " Your user access token for w2g.tv. Can be found at https://w2g.tv/en/account/edit_user under Tools/API\n"));
48
+ await help();
49
+ return;
50
+ }),
51
+ (async () => {
52
+ return;
53
+ })
54
+ ];
55
+ async function help() {
56
+ console.log(chalk.cyan("Help page select: \n"));
57
+ return helps[await (0, input_1.selection)(["Playing", "Downloading", "Options", "Quit"], ["p", "d", "o", "q"])]();
58
+ }
59
+ exports.help = help;