ani-cli-npm 1.2.0 → 1.2.1
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.
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<component name="InspectionProjectProfileManager">
|
|
2
|
+
<profile version="1.0">
|
|
3
|
+
<option name="myName" value="Project Default" />
|
|
4
|
+
<inspection_tool class="DuplicatedCode" enabled="true" level="WEAK WARNING" enabled_by_default="true">
|
|
5
|
+
<Languages>
|
|
6
|
+
<language minSize="76" name="JavaScript" />
|
|
7
|
+
</Languages>
|
|
8
|
+
</inspection_tool>
|
|
9
|
+
</profile>
|
|
10
|
+
</component>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"proxy":"","user_agent":"Mozilla/5.0 (X11; Linux x86_64; rv:99.0) Gecko/20100101 Firefox/100.0"}
|
package/bin/index.js
CHANGED
|
@@ -17,7 +17,30 @@ const fetch = require('node-fetch');
|
|
|
17
17
|
const PlayerController = require("media-player-controller")
|
|
18
18
|
const open = require("open")
|
|
19
19
|
const prompt = require("simple-input");
|
|
20
|
+
const getAppDataPath = require("appdata-path")
|
|
21
|
+
const fs = require("fs")
|
|
20
22
|
|
|
23
|
+
let config = {
|
|
24
|
+
player: "BROWSER",
|
|
25
|
+
proxy: "",
|
|
26
|
+
user_agent: "Mozilla/5.0 (X11; Linux x86_64; rv:99.0) Gecko/20100101 Firefox/100.0"
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
try{
|
|
30
|
+
let config = JSON.parse(fs.readFileSync(getAppDataPath()+"/ani-cli-npm.conf")) //getAppDataPath()
|
|
31
|
+
if (!config.hasOwnProperty("player")){
|
|
32
|
+
config.player = "BROWSER"
|
|
33
|
+
}
|
|
34
|
+
if (!config.hasOwnProperty("user_agent")){
|
|
35
|
+
config.user_agent = "Mozilla/5.0 (X11; Linux x86_64; rv:99.0) Gecko/20100101 Firefox/100.0"
|
|
36
|
+
}
|
|
37
|
+
if (!config.hasOwnProperty("proxy")){
|
|
38
|
+
config.user_agent = ""
|
|
39
|
+
}
|
|
40
|
+
fs.writeFileSync(getAppDataPath()+"/ani-cli-npm.conf", JSON.stringify(config))
|
|
41
|
+
}catch{
|
|
42
|
+
fs.writeFileSync(getAppDataPath()+"/ani-cli-npm.conf", JSON.stringify(config))
|
|
43
|
+
}
|
|
21
44
|
|
|
22
45
|
const gogohd_url="https://gogohd.net/"
|
|
23
46
|
const base_url="https://animixplay.to"
|
|
@@ -31,11 +54,7 @@ const colors = {
|
|
|
31
54
|
Cyan: "\x1b[36m%s\x1b[0m",
|
|
32
55
|
White: "\x1b[37m%s\x1b[0m"
|
|
33
56
|
}
|
|
34
|
-
|
|
35
|
-
player: "MPV",
|
|
36
|
-
proxy: "",
|
|
37
|
-
user_agent: 'Mozilla/5.0 (X11; Linux x86_64; rv:99.0) Gecko/20100101 Firefox/100.0'
|
|
38
|
-
}
|
|
57
|
+
|
|
39
58
|
|
|
40
59
|
//const HttpsProxyAgent = require('https-proxy-agent');
|
|
41
60
|
//let proxyAgent = new HttpsProxyAgent(config.proxy);
|
|
@@ -43,7 +62,7 @@ let config = {
|
|
|
43
62
|
|
|
44
63
|
async function config_(temp){
|
|
45
64
|
console.clear()
|
|
46
|
-
console.log(colors.Blue, "ANI-CLI-NPM \n")
|
|
65
|
+
console.log(colors.Blue, "ANI-CLI-NPM \n")
|
|
47
66
|
console.log(colors.Yellow, "Config:\n")
|
|
48
67
|
console.log(colors.Cyan, `1) Player; ${temp.player}`)
|
|
49
68
|
console.log(colors.Cyan, `2) Proxy; ${temp.proxy}`)
|
|
@@ -251,11 +270,12 @@ async function generate_link(provider, id){
|
|
|
251
270
|
buffer = new Buffer(id+"LTXs3GrU8we9O"+enc_id)
|
|
252
271
|
let ani_id = buffer.toString("base64")
|
|
253
272
|
buffer = Buffer.from((await curl(`${base_url}/api/live${ani_id}`, "GET", true)).split("#")[1], "base64")
|
|
254
|
-
if (config.player === "
|
|
255
|
-
return
|
|
273
|
+
if (config.player === "BROWSER"){
|
|
274
|
+
return `${base_url}/api/live${ani_id}`
|
|
256
275
|
}
|
|
276
|
+
return buffer.toString("utf-8") //TODO m3u8 player
|
|
257
277
|
|
|
258
|
-
|
|
278
|
+
|
|
259
279
|
}
|
|
260
280
|
}
|
|
261
281
|
|
|
@@ -398,6 +418,9 @@ async function search(){
|
|
|
398
418
|
console.clear()
|
|
399
419
|
console.log(colors.Blue, "Welcome to Ani-Cli-npm")
|
|
400
420
|
async function main(){
|
|
421
|
+
if (config.player === "VLC"){
|
|
422
|
+
console.log(colors.Red, "Warning; if you do not have mpv video player installed, you will have to change your video player to either vlc or browser in config.\n")
|
|
423
|
+
}
|
|
401
424
|
console.log(colors.Cyan, "1/s) Search")
|
|
402
425
|
console.log(colors.Cyan, "2/c) config")
|
|
403
426
|
console.log(colors.Cyan, "3/q) quit")
|
|
@@ -428,6 +451,11 @@ async function main(){
|
|
|
428
451
|
break
|
|
429
452
|
}
|
|
430
453
|
}
|
|
454
|
+
try{
|
|
455
|
+
fs.writeFileSync(getAppDataPath()+"/ani-cli-npm.conf", JSON.stringify(config))
|
|
456
|
+
}catch{
|
|
457
|
+
console.log(colors.Red, "Error writing to .conf file.")
|
|
458
|
+
}
|
|
431
459
|
await main()
|
|
432
460
|
break
|
|
433
461
|
case "q":
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ani-cli-npm",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"description": "ani-cli tool rewritten as npm package",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
"multiply": "bin/index.js"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
+
"appdata-path": "^1.0.0",
|
|
27
28
|
"media-player-controller": "^1.5.3",
|
|
28
29
|
"node-fetch": "^2.6.6",
|
|
29
30
|
"open": "^8.4.0",
|