ani-cli-npm 1.0.4 → 1.0.5
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 +7 -0
- package/.idea/jsLibraryMappings.xml +5 -5
- package/.idea/modules.xml +7 -7
- package/.idea/vcs.xml +5 -5
- package/README.MD +7 -7
- package/bin/index.js +426 -438
- package/index.cjs +45 -0
- package/package.json +28 -28
- package/.idea/git_toolbox_prj.xml +0 -15
package/.idea/ani-cli-npm.iml
CHANGED
@@ -1,12 +1,12 @@
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
-
<module type="WEB_MODULE" version="4">
|
3
|
-
<component name="NewModuleRootManager">
|
4
|
-
<content url="file://$MODULE_DIR$">
|
5
|
-
<excludeFolder url="file://$MODULE_DIR$/temp" />
|
6
|
-
<excludeFolder url="file://$MODULE_DIR$/.tmp" />
|
7
|
-
<excludeFolder url="file://$MODULE_DIR$/tmp" />
|
8
|
-
</content>
|
9
|
-
<orderEntry type="inheritedJdk" />
|
10
|
-
<orderEntry type="sourceFolder" forTests="false" />
|
11
|
-
</component>
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<module type="WEB_MODULE" version="4">
|
3
|
+
<component name="NewModuleRootManager">
|
4
|
+
<content url="file://$MODULE_DIR$">
|
5
|
+
<excludeFolder url="file://$MODULE_DIR$/temp" />
|
6
|
+
<excludeFolder url="file://$MODULE_DIR$/.tmp" />
|
7
|
+
<excludeFolder url="file://$MODULE_DIR$/tmp" />
|
8
|
+
</content>
|
9
|
+
<orderEntry type="inheritedJdk" />
|
10
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
11
|
+
</component>
|
12
12
|
</module>
|
@@ -1,6 +1,6 @@
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
-
<project version="4">
|
3
|
-
<component name="JavaScriptLibraryMappings">
|
4
|
-
<includedPredefinedLibrary name="Node.js Core" />
|
5
|
-
</component>
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<project version="4">
|
3
|
+
<component name="JavaScriptLibraryMappings">
|
4
|
+
<includedPredefinedLibrary name="Node.js Core" />
|
5
|
+
</component>
|
6
6
|
</project>
|
package/.idea/modules.xml
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
-
<project version="4">
|
3
|
-
<component name="ProjectModuleManager">
|
4
|
-
<modules>
|
5
|
-
<module fileurl="file://$PROJECT_DIR$/.idea/ani-cli-npm.iml" filepath="$PROJECT_DIR$/.idea/ani-cli-npm.iml" />
|
6
|
-
</modules>
|
7
|
-
</component>
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<project version="4">
|
3
|
+
<component name="ProjectModuleManager">
|
4
|
+
<modules>
|
5
|
+
<module fileurl="file://$PROJECT_DIR$/.idea/ani-cli-npm.iml" filepath="$PROJECT_DIR$/.idea/ani-cli-npm.iml" />
|
6
|
+
</modules>
|
7
|
+
</component>
|
8
8
|
</project>
|
package/.idea/vcs.xml
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
-
<project version="4">
|
3
|
-
<component name="VcsDirectoryMappings">
|
4
|
-
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
5
|
-
</component>
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<project version="4">
|
3
|
+
<component name="VcsDirectoryMappings">
|
4
|
+
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
5
|
+
</component>
|
6
6
|
</project>
|
package/README.MD
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
# ANI-CLI-NPM
|
2
|
-
|
3
|
-
## Instalation:
|
4
|
-
|
5
|
-
### 1. Install npm/node
|
6
|
-
### 2. npx ani-cli-npm
|
7
|
-
### 3. done
|
1
|
+
# ANI-CLI-NPM
|
2
|
+
|
3
|
+
## Instalation:
|
4
|
+
|
5
|
+
### 1. Install npm/node
|
6
|
+
### 2. npx ani-cli-npm
|
7
|
+
### 3. done
|
package/bin/index.js
CHANGED
@@ -1,438 +1,426 @@
|
|
1
|
-
#! /usr/bin/env node
|
2
|
-
|
3
|
-
const {emitWarning} = process;
|
4
|
-
|
5
|
-
process.emitWarning = (warning, ...args) => {
|
6
|
-
if (args[0] === 'ExperimentalWarning') {
|
7
|
-
return;
|
8
|
-
}
|
9
|
-
|
10
|
-
if (args[0] && typeof args[0] === 'object' && args[0].type === 'ExperimentalWarning') {
|
11
|
-
return;
|
12
|
-
}
|
13
|
-
|
14
|
-
return emitWarning(warning, ...args);
|
15
|
-
};
|
16
|
-
|
17
|
-
const VLC = require('vlc-simple-player');
|
18
|
-
const open = require("open")
|
19
|
-
const prompt = require("simple-input");
|
20
|
-
const fs = require("fs");
|
21
|
-
|
22
|
-
const
|
23
|
-
|
24
|
-
const
|
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
|
-
console.
|
50
|
-
|
51
|
-
console.log(colors.
|
52
|
-
console.log(colors.Cyan, `
|
53
|
-
console.log(colors.Cyan,
|
54
|
-
console.log(colors.Cyan,
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
temp
|
72
|
-
|
73
|
-
|
74
|
-
temp
|
75
|
-
|
76
|
-
|
77
|
-
return temp,
|
78
|
-
case
|
79
|
-
return temp,
|
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
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
lines =
|
159
|
-
|
160
|
-
let
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
}
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
let
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
}
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
console.log(colors.
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
console.log("
|
364
|
-
|
365
|
-
console.log(colors.
|
366
|
-
|
367
|
-
console.
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
}
|
428
|
-
}
|
429
|
-
await main()
|
430
|
-
break
|
431
|
-
case 3:
|
432
|
-
console.log(colors.Black, "Exiting...")
|
433
|
-
process.exit()
|
434
|
-
}
|
435
|
-
}
|
436
|
-
|
437
|
-
main()
|
438
|
-
|
1
|
+
#! /usr/bin/env node
|
2
|
+
|
3
|
+
const {emitWarning} = process;
|
4
|
+
|
5
|
+
process.emitWarning = (warning, ...args) => {
|
6
|
+
if (args[0] === 'ExperimentalWarning') {
|
7
|
+
return;
|
8
|
+
}
|
9
|
+
|
10
|
+
if (args[0] && typeof args[0] === 'object' && args[0].type === 'ExperimentalWarning') {
|
11
|
+
return;
|
12
|
+
}
|
13
|
+
|
14
|
+
return emitWarning(warning, ...args);
|
15
|
+
};
|
16
|
+
|
17
|
+
const VLC = require('vlc-simple-player');
|
18
|
+
const open = require("open")
|
19
|
+
const prompt = require("simple-input");
|
20
|
+
const fs = require("fs");
|
21
|
+
//const HttpsProxyAgent = require('https-proxy-agent');
|
22
|
+
//const proxyAgent = new HttpsProxyAgent("68.183.230.116:3951");
|
23
|
+
|
24
|
+
const gogohd_url="https://gogohd.net/"
|
25
|
+
const base_url="https://animixplay.to"
|
26
|
+
const colors = {
|
27
|
+
Black: "\x1b[30m%s\x1b[0m",
|
28
|
+
Red: "\x1b[31m%s\x1b[0m",
|
29
|
+
Green: "\x1b[32m%s\x1b[0m",
|
30
|
+
Yellow: "\x1b[33m%s\x1b[0m",
|
31
|
+
Blue: "\x1b[34m%s\x1b[0m",
|
32
|
+
Magenta: "\x1b[35m%s\x1b[0m",
|
33
|
+
Cyan: "\x1b[36m%s\x1b[0m",
|
34
|
+
White: "\x1b[37m%s\x1b[0m"
|
35
|
+
}
|
36
|
+
let config = {
|
37
|
+
player: "VLC",
|
38
|
+
proxy: "",
|
39
|
+
user_agent: 'Mozilla/5.0 (X11; Linux x86_64; rv:99.0) Gecko/20100101 Firefox/100.0'
|
40
|
+
}
|
41
|
+
|
42
|
+
const HttpsProxyAgent = require('https-proxy-agent');
|
43
|
+
let proxyAgent = new HttpsProxyAgent(config.proxy);
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
|
48
|
+
async function config_(temp){
|
49
|
+
console.clear()
|
50
|
+
console.log(colors.Blue, "ANI-CLI-NPM \n")
|
51
|
+
console.log(colors.Yellow, "Config:\n")
|
52
|
+
console.log(colors.Cyan, `1) Player; ${temp.player}`)
|
53
|
+
console.log(colors.Cyan, `2) Proxy; ${temp.proxy}`)
|
54
|
+
console.log(colors.Cyan, `3) User agent; ${temp.user_agent}`)
|
55
|
+
console.log(colors.Cyan, "4) Save and exit")
|
56
|
+
console.log(colors.Cyan, "5) Exit without saving changes")
|
57
|
+
let choice = parseInt(await input(""));
|
58
|
+
switch (choice){
|
59
|
+
case 1:
|
60
|
+
console.log(colors.Cyan, `1) VLC (default)`)
|
61
|
+
console.log(colors.Cyan, `2) Browser`)
|
62
|
+
let player = parseInt(await(input("New Player;")))
|
63
|
+
switch (player){
|
64
|
+
case 1:
|
65
|
+
temp.player = "VLC"
|
66
|
+
break
|
67
|
+
case 2:
|
68
|
+
temp.player = "BROWSER"
|
69
|
+
break
|
70
|
+
}
|
71
|
+
return temp,0
|
72
|
+
case 2:
|
73
|
+
temp.proxy = (await(input("New Proxy;"))).replaceAll(" ", "")
|
74
|
+
return temp, 0
|
75
|
+
case 3:
|
76
|
+
temp.user_agent = await(input("New User agent;"))
|
77
|
+
return temp, 0
|
78
|
+
case 4:
|
79
|
+
return temp, 1
|
80
|
+
case 5:
|
81
|
+
return temp, 2
|
82
|
+
}
|
83
|
+
}
|
84
|
+
|
85
|
+
|
86
|
+
async function input(message){
|
87
|
+
if (message){
|
88
|
+
console.log(colors.Magenta,message)
|
89
|
+
}
|
90
|
+
return await prompt(">")
|
91
|
+
}
|
92
|
+
|
93
|
+
|
94
|
+
async function curl(url, method="GET"){
|
95
|
+
try{
|
96
|
+
await fetch(url, {
|
97
|
+
//"agent": proxyAgent,
|
98
|
+
"headers": {
|
99
|
+
'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:99.0) Gecko/20100101 Firefox/100.0',
|
100
|
+
"X-Requested-With": "XMLHttpRequest"
|
101
|
+
},
|
102
|
+
"referrerPolicy": "origin",
|
103
|
+
"body": null,
|
104
|
+
"method": method,
|
105
|
+
"proxy": "68.183.230.116:3951"
|
106
|
+
}).then(function (response) {
|
107
|
+
return response.text();
|
108
|
+
}).then(function (html) {
|
109
|
+
fs.writeFileSync("./temp.txt", html, function(err) {
|
110
|
+
if(err) {
|
111
|
+
return console.log(err);
|
112
|
+
}
|
113
|
+
});
|
114
|
+
}).catch(async function(err) {
|
115
|
+
console.warn(colors.Red, `Something went wrong connecting to ${url}.`);
|
116
|
+
await search();
|
117
|
+
process.exit()
|
118
|
+
});
|
119
|
+
|
120
|
+
return fs.readFileSync("./temp.txt").toString()
|
121
|
+
}catch{
|
122
|
+
console.log(colors.Red, "Something went wrong in curl()")
|
123
|
+
await main()
|
124
|
+
}
|
125
|
+
|
126
|
+
}
|
127
|
+
|
128
|
+
|
129
|
+
function matchRuleShort(str, rule) {
|
130
|
+
let escapeRegex = (str) => str.replace(/([.*+?^=!:${}()|\[\]\/\\])/g, "\\$1");
|
131
|
+
return new RegExp("^" + rule.split("*").map(escapeRegex).join(".*") + "$").test(str);
|
132
|
+
}
|
133
|
+
|
134
|
+
|
135
|
+
async function search_anime(search){
|
136
|
+
let filter = "*<ahref=\"/category/*\"title=\"*\">"
|
137
|
+
let html = (await curl("https://gogoanime.dk//search.html?keyword="+search)).split("\n")
|
138
|
+
let lines = []
|
139
|
+
for (x in html){
|
140
|
+
html[x] = html[x].replaceAll(/ /g,'').replaceAll(/\t/g,'')
|
141
|
+
if (matchRuleShort(html[x], filter)){
|
142
|
+
html[x] = html[x].slice(html[x].indexOf("/category/")+10);
|
143
|
+
html[x] = html[x].slice(0, html[x].indexOf("\"title="));
|
144
|
+
lines.push(html[x])
|
145
|
+
}
|
146
|
+
}
|
147
|
+
if (!lines[0]){
|
148
|
+
lines.pop()
|
149
|
+
}
|
150
|
+
|
151
|
+
|
152
|
+
return lines
|
153
|
+
}
|
154
|
+
|
155
|
+
|
156
|
+
async function episode_list(anime_id){
|
157
|
+
let html = (await curl(base_url+"/v1/"+anime_id)).split("\n")
|
158
|
+
let lines = ""
|
159
|
+
|
160
|
+
for (let x in html){
|
161
|
+
if(matchRuleShort(html[x], "*<div id=\"epslistplace\"*")){
|
162
|
+
lines = (html[x])
|
163
|
+
}
|
164
|
+
}
|
165
|
+
|
166
|
+
lines = lines.slice(55, lines.length).replace("}</div>", "")
|
167
|
+
lines = "{" + lines.slice(lines.indexOf(",")+1, lines.length) + "}"
|
168
|
+
lines = JSON.parse(lines)
|
169
|
+
|
170
|
+
let json = []
|
171
|
+
for (x in lines){
|
172
|
+
json.push(lines[x])
|
173
|
+
}
|
174
|
+
return json
|
175
|
+
}
|
176
|
+
|
177
|
+
|
178
|
+
async function download(url, name){
|
179
|
+
console.log(colors.Red, "Feature not implemented yet. Sorry for any inconvenience.\nIf you need to download a video, request the link, then download it via your internet browser of choice.")
|
180
|
+
}
|
181
|
+
|
182
|
+
|
183
|
+
async function selection(options, prompt){
|
184
|
+
let selection = 0
|
185
|
+
while (!(selection <= options && selection > 1)){
|
186
|
+
selection = (await input(prompt))
|
187
|
+
if (selection <= options && selection >= 1){
|
188
|
+
break
|
189
|
+
}
|
190
|
+
console.log(colors.Red,`Please input a valid option.`)
|
191
|
+
}
|
192
|
+
return selection
|
193
|
+
}
|
194
|
+
|
195
|
+
|
196
|
+
async function process_search(query) {
|
197
|
+
console.log(colors.Yellow, "Searching: "+query)
|
198
|
+
|
199
|
+
let search_results = await search_anime(query)
|
200
|
+
if (!search_results[0]) {
|
201
|
+
console.log(colors.Red, "No results.")
|
202
|
+
await main()
|
203
|
+
process.exit()
|
204
|
+
} else {
|
205
|
+
for (x in search_results) {
|
206
|
+
console.log(colors.Cyan,`${parseInt(x)+1})${" ".repeat(((search_results.length).toString().length+1)-((parseInt(x)+1).toString().length))}${search_results[x].replaceAll("-", " ")}`)
|
207
|
+
}
|
208
|
+
}
|
209
|
+
|
210
|
+
let anime_id = search_results[await selection(search_results.length, "Please select an anime.")-1]
|
211
|
+
let episodes = await episode_list(anime_id)
|
212
|
+
let episode_number = 0;
|
213
|
+
if (episodes.length > 1){
|
214
|
+
episode_number = (await selection(episodes.length, `Please select an episode (1-${episodes.length}).`))-1
|
215
|
+
}
|
216
|
+
return {
|
217
|
+
anime_id: anime_id,
|
218
|
+
episodes: episodes,
|
219
|
+
episode_number: episode_number
|
220
|
+
}
|
221
|
+
}
|
222
|
+
|
223
|
+
|
224
|
+
async function get_video_link(episode_dpage){
|
225
|
+
let id = episode_dpage.replace("//gogohd.net/streaming.php?id=","")
|
226
|
+
id = id.slice(0, id.indexOf("="))
|
227
|
+
|
228
|
+
return await generate_link(1,id)
|
229
|
+
}
|
230
|
+
|
231
|
+
|
232
|
+
async function generate_link(provider, id){
|
233
|
+
let html = ""
|
234
|
+
let provider_name = ""
|
235
|
+
switch (provider) {
|
236
|
+
case 1:
|
237
|
+
html = await curl(`${gogohd_url}streaming.php?id=${id}`)
|
238
|
+
provider_name = 'Xstreamcdn'
|
239
|
+
console.log(colors.Yellow, `Fetching ${provider_name} links...`)
|
240
|
+
html = html.split("\n")
|
241
|
+
let fb_id = ""
|
242
|
+
for (x in html){
|
243
|
+
if (matchRuleShort(html[x], "*<li class=\"linkserver\" data-status=\"1\" data-video=\"https://fembed9hd.com/v/*")){
|
244
|
+
fb_id = html[x].slice(html[x].indexOf("/v/")+3, html[x].indexOf("\">X"))
|
245
|
+
break
|
246
|
+
}
|
247
|
+
}
|
248
|
+
if (!fb_id){
|
249
|
+
console.log("Error, no fb_id found.")
|
250
|
+
return 0
|
251
|
+
}
|
252
|
+
|
253
|
+
//let refr = "https://fembed-hd.com/v/"+fb_id
|
254
|
+
let post = await curl("https://fembed-hd.com/api/source/"+fb_id, "POST")
|
255
|
+
post = post.slice(post.indexOf(",\"data\":[{\"file\":\"")+18, post.length)
|
256
|
+
post = post.slice(0, post.indexOf("\"")).replaceAll("\\/","/")
|
257
|
+
return post
|
258
|
+
/*case 2:
|
259
|
+
provider_name = 'Animixplay'
|
260
|
+
console.log(`${base_url}/api/live/${"TkRBMk9EVT1MVFhzM0dyVTh3ZTlPVGtSQk1rOUVWVDA9"}`)
|
261
|
+
console.log(colors.Yellow, `Fetching ${provider_name} links...`)
|
262
|
+
let refr="$base_url"
|
263
|
+
let links = []
|
264
|
+
html = (await curl(`${base_url}/api/live/${"Some variable?"}`)).split("\n") // this needs fixed for alot of bigger titles to work.
|
265
|
+
for (x in html){
|
266
|
+
console.log(html[x])
|
267
|
+
}
|
268
|
+
*/
|
269
|
+
|
270
|
+
|
271
|
+
}
|
272
|
+
}
|
273
|
+
|
274
|
+
|
275
|
+
async function get_video_quality_m3u8(){
|
276
|
+
console.log(colors.Red, "Not sure how you even got to this function? Its not implemented yet.")
|
277
|
+
}
|
278
|
+
|
279
|
+
async function post_play(link, anime, player="VLC"){
|
280
|
+
while (true){
|
281
|
+
console.log(colors.Yellow, `Playing episode ${anime.episode_number+1} of ${anime.anime_id.replaceAll("-", " ")}\n`)
|
282
|
+
console.log(colors.Cyan, "1) Show Link")
|
283
|
+
console.log(colors.Cyan, "2) Next Episode")
|
284
|
+
console.log(colors.Cyan, "3) Prev Episode")
|
285
|
+
console.log(colors.Cyan, "4) Quit")
|
286
|
+
choice = parseInt(await input("select;"))
|
287
|
+
switch (choice){
|
288
|
+
case 1:
|
289
|
+
console.clear()
|
290
|
+
console.log(colors.Blue, "ANI-CLI-NPM \n")
|
291
|
+
console.log(colors.Yellow, "Link: "+link)
|
292
|
+
break
|
293
|
+
case 2:
|
294
|
+
if (anime.episode_number > anime.episodes.length-2){
|
295
|
+
console.clear()
|
296
|
+
console.log(colors.Red, "Damn, all out of episodes?")
|
297
|
+
break
|
298
|
+
}
|
299
|
+
anime.episode_number += 1
|
300
|
+
link = await get_video_link(anime.episodes[anime.episode_number])
|
301
|
+
await play(link, anime, config.player)
|
302
|
+
process.exit()
|
303
|
+
break
|
304
|
+
//EVEN MORE NEEDLESS QUIT STATEMENTS!!!!!!
|
305
|
+
case 3:
|
306
|
+
if (anime.episode_number < 2){
|
307
|
+
console.clear()
|
308
|
+
console.log(colors.Red, "Error; Episode 0 is only available for premium members")
|
309
|
+
break
|
310
|
+
}
|
311
|
+
anime.episode_number -= 1
|
312
|
+
link = await get_video_link(anime.episodes[anime.episode_number])
|
313
|
+
await play(link, anime, config.player)
|
314
|
+
process.exit()
|
315
|
+
break
|
316
|
+
case 4:
|
317
|
+
console.clear()
|
318
|
+
await main()
|
319
|
+
process.exit()
|
320
|
+
break
|
321
|
+
}
|
322
|
+
}
|
323
|
+
}
|
324
|
+
|
325
|
+
async function play(link, anime, player="VLC"){
|
326
|
+
console.clear()
|
327
|
+
console.log(colors.Blue, "ANI-CLI-NPM \n")
|
328
|
+
if (player === "VLC"){
|
329
|
+
console.log(colors.Yellow, "Loading VLC... ")
|
330
|
+
let player = new VLC(link)
|
331
|
+
await post_play(link, anime)
|
332
|
+
process.exit()
|
333
|
+
|
334
|
+
|
335
|
+
}else if (player === "BROWSER"){
|
336
|
+
console.log(colors.Yellow, "Opening video in browser... ")
|
337
|
+
open(link)
|
338
|
+
await post_play(link, anime, player)
|
339
|
+
process.exit()
|
340
|
+
}
|
341
|
+
}
|
342
|
+
|
343
|
+
|
344
|
+
async function search(){
|
345
|
+
console.clear()
|
346
|
+
console.log(colors.Blue, "ANI-CLI-NPM \n")
|
347
|
+
console.log(colors.Magenta, "Search...")
|
348
|
+
let choice = await input("")
|
349
|
+
let anime = await process_search(choice)
|
350
|
+
|
351
|
+
console.log("\n")
|
352
|
+
|
353
|
+
console.log(colors.Blue, "Indexing video...")
|
354
|
+
let link = await get_video_link(anime.episodes[anime.episode_number])
|
355
|
+
console.clear()
|
356
|
+
console.log(colors.Blue, "ANI-CLI-NPM \n")
|
357
|
+
if (!link){
|
358
|
+
console.log(colors.Red, "Np link for this episode found?")
|
359
|
+
console.log(colors.Yellow, "^ at current this is due to not all of the required video repos being implemented.")
|
360
|
+
console.log(colors.Yellow, "Sorry for any inconvenience, this should soon by implemented. We appreciate your patience.")
|
361
|
+
process.exit()
|
362
|
+
}
|
363
|
+
console.log(colors.Blue, `Episode ${anime.episode_number+1} of ${anime.anime_id.replaceAll("-", " ")} found.\n`)
|
364
|
+
console.log(colors.Cyan, "1) Play")
|
365
|
+
console.log(colors.Cyan, "2) Download")
|
366
|
+
console.log(colors.Cyan, "3) Show Link")
|
367
|
+
console.log(colors.Cyan, "4) quit")
|
368
|
+
choice = parseInt(await input("select;"))
|
369
|
+
switch (choice){
|
370
|
+
case 1:
|
371
|
+
await play(link, anime, config.player)
|
372
|
+
break
|
373
|
+
case 2:
|
374
|
+
download(link, anime.anime_id+anime.episode_number+".mp4")
|
375
|
+
break
|
376
|
+
case 3:
|
377
|
+
console.log(colors.Yellow, "Link: "+link)
|
378
|
+
break
|
379
|
+
case 4:
|
380
|
+
process.exit()
|
381
|
+
}
|
382
|
+
}
|
383
|
+
|
384
|
+
|
385
|
+
console.clear()
|
386
|
+
console.log(colors.Blue, "Welcome to Ani-Cli-npm")
|
387
|
+
async function main(){
|
388
|
+
console.log(colors.Cyan, "1) Search")
|
389
|
+
console.log(colors.Cyan, "2) config")
|
390
|
+
console.log(colors.Cyan, "3) quit")
|
391
|
+
let choice = parseInt(await input("select;"))
|
392
|
+
|
393
|
+
switch (choice){
|
394
|
+
case 1:
|
395
|
+
await search()
|
396
|
+
break
|
397
|
+
case 2:
|
398
|
+
let temp = structuredClone(config);
|
399
|
+
let exit_code;
|
400
|
+
while (true) {
|
401
|
+
temp, exit_code = await config_(temp)
|
402
|
+
if (exit_code === 1) {
|
403
|
+
config = temp
|
404
|
+
proxyAgent = new HttpsProxyAgent(config.proxy);
|
405
|
+
console.clear()
|
406
|
+
console.log(colors.Blue, "ANI-CLI-NPM \n")
|
407
|
+
console.log(colors.Yellow, "Config changed.")
|
408
|
+
break
|
409
|
+
} else if (exit_code === 2) {
|
410
|
+
temp = config
|
411
|
+
console.clear()
|
412
|
+
console.log(colors.Blue, "ANI-CLI-NPM \n")
|
413
|
+
console.log(colors.Yellow, "Config changes disregarded.")
|
414
|
+
break
|
415
|
+
}
|
416
|
+
}
|
417
|
+
await main()
|
418
|
+
break
|
419
|
+
case 3:
|
420
|
+
console.log(colors.Black, "Exiting...")
|
421
|
+
process.exit()
|
422
|
+
}
|
423
|
+
}
|
424
|
+
|
425
|
+
main()
|
426
|
+
|
package/index.cjs
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
|
2
|
+
const HttpsProxyAgent = require("http-proxy-agent")
|
3
|
+
const cluster = require("cluster");
|
4
|
+
const os = require("os")
|
5
|
+
|
6
|
+
//const proxylist = require("./proxylist.json")
|
7
|
+
function makereq(url, agent) {
|
8
|
+
return new Promise((res,rej) => {
|
9
|
+
fetch("https://animixplay.to/v1/one-punch-man", {
|
10
|
+
"headers": {
|
11
|
+
"accept": "text/html,application/xhtml+xml,application/9",
|
12
|
+
"accept-language": "en-GB,en-US;q=0.9,en;q=0.8",
|
13
|
+
"cache-control": "max-age=0",
|
14
|
+
"sec-ch-ua": "\"Not-A.Brand\";v=\"99\", \"Opera GX\";v=\"91\", \"Chromium\";v=\"105\"",
|
15
|
+
"sec-ch-ua-mobile": "?0",
|
16
|
+
"sec-ch-ua-platform": "\"Windows\"",
|
17
|
+
"sec-fetch-dest": "document",
|
18
|
+
"sec-fetch-mode": "navigate",
|
19
|
+
"sec-fetch-site": "none",
|
20
|
+
"sec-fetch-user": "?1",
|
21
|
+
"upgrade-insecure-requests": "1",
|
22
|
+
//"cookie": "animix_ses=78c4mbvq1g8v3kjdrbo85m5c8sbpjagkjbip"
|
23
|
+
},
|
24
|
+
"referrerPolicy": "strict-origin-when-cross-origin",
|
25
|
+
"body": null,
|
26
|
+
"method": "GET",
|
27
|
+
"proxy": ""
|
28
|
+
}).then(function (response) {
|
29
|
+
// The API call was successful!
|
30
|
+
return response.text();
|
31
|
+
}).then(function (html) {
|
32
|
+
// This is the HTML from our response as a text string
|
33
|
+
console.log(html);
|
34
|
+
return html
|
35
|
+
})
|
36
|
+
})
|
37
|
+
}
|
38
|
+
|
39
|
+
async function main() {
|
40
|
+
let proxy = "194.195.213.197:1080"
|
41
|
+
let html = await makereq("", new HttpsProxyAgent(proxy))
|
42
|
+
console.log(html)
|
43
|
+
}
|
44
|
+
|
45
|
+
main()
|
package/package.json
CHANGED
@@ -1,28 +1,28 @@
|
|
1
|
-
{
|
2
|
-
"name": "ani-cli-npm",
|
3
|
-
"version": "1.0.
|
4
|
-
"description": "ani-cli tool rewritten as npm package",
|
5
|
-
"main": "index.js",
|
6
|
-
"scripts": {
|
7
|
-
"start": "node bin/index.js",
|
8
|
-
"test": "echo \"Error: no test specified\" && exit 1"
|
9
|
-
},
|
10
|
-
"keywords": [
|
11
|
-
"anime",
|
12
|
-
"ani-cli",
|
13
|
-
"anime",
|
14
|
-
"client"
|
15
|
-
],
|
16
|
-
"author": "bumpkin-pi",
|
17
|
-
"license": "ISC",
|
18
|
-
"bin": {
|
19
|
-
"multiply": "bin/index.js"
|
20
|
-
},
|
21
|
-
"dependencies": {
|
22
|
-
"http-proxy-agent": "^5.0.0",
|
23
|
-
"https-proxy-agent": "^5.0.1",
|
24
|
-
"open": "^8.4.0",
|
25
|
-
"simple-input": "^1.0.1",
|
26
|
-
"vlc-simple-player": "^0.5.1"
|
27
|
-
}
|
28
|
-
}
|
1
|
+
{
|
2
|
+
"name": "ani-cli-npm",
|
3
|
+
"version": "1.0.5",
|
4
|
+
"description": "ani-cli tool rewritten as npm package",
|
5
|
+
"main": "index.js",
|
6
|
+
"scripts": {
|
7
|
+
"start": "node bin/index.js",
|
8
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
9
|
+
},
|
10
|
+
"keywords": [
|
11
|
+
"anime",
|
12
|
+
"ani-cli",
|
13
|
+
"anime",
|
14
|
+
"client"
|
15
|
+
],
|
16
|
+
"author": "bumpkin-pi",
|
17
|
+
"license": "ISC",
|
18
|
+
"bin": {
|
19
|
+
"multiply": "bin/index.js"
|
20
|
+
},
|
21
|
+
"dependencies": {
|
22
|
+
"http-proxy-agent": "^5.0.0",
|
23
|
+
"https-proxy-agent": "^5.0.1",
|
24
|
+
"open": "^8.4.0",
|
25
|
+
"simple-input": "^1.0.1",
|
26
|
+
"vlc-simple-player": "^0.5.1"
|
27
|
+
}
|
28
|
+
}
|
@@ -1,15 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
-
<project version="4">
|
3
|
-
<component name="GitToolBoxProjectSettings">
|
4
|
-
<option name="commitMessageIssueKeyValidationOverride">
|
5
|
-
<BoolValueOverride>
|
6
|
-
<option name="enabled" value="true" />
|
7
|
-
</BoolValueOverride>
|
8
|
-
</option>
|
9
|
-
<option name="commitMessageValidationEnabledOverride">
|
10
|
-
<BoolValueOverride>
|
11
|
-
<option name="enabled" value="true" />
|
12
|
-
</BoolValueOverride>
|
13
|
-
</option>
|
14
|
-
</component>
|
15
|
-
</project>
|