ani-cli-npm 1.0.7 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="DiscordProjectSettings">
4
+ <option name="show" value="ASK" />
5
+ <option name="description" value="" />
6
+ </component>
7
+ </project>
package/bin/index.js CHANGED
@@ -43,8 +43,6 @@ const HttpsProxyAgent = require('https-proxy-agent');
43
43
  let proxyAgent = new HttpsProxyAgent(config.proxy);
44
44
 
45
45
 
46
-
47
-
48
46
  async function config_(temp){
49
47
  console.clear()
50
48
  console.log(colors.Blue, "ANI-CLI-NPM \n")
@@ -82,7 +80,6 @@ console.log(colors.Blue, "ANI-CLI-NPM \n")
82
80
  }
83
81
  }
84
82
 
85
-
86
83
  async function input(message){
87
84
  if (message){
88
85
  console.log(colors.Magenta,message)
@@ -90,7 +87,6 @@ async function input(message){
90
87
  return await prompt(">")
91
88
  }
92
89
 
93
-
94
90
  async function curl(url, method="GET"){
95
91
  try{
96
92
  await fetch(url, {
@@ -125,13 +121,11 @@ async function curl(url, method="GET"){
125
121
 
126
122
  }
127
123
 
128
-
129
124
  function matchRuleShort(str, rule) {
130
125
  let escapeRegex = (str) => str.replace(/([.*+?^=!:${}()|\[\]\/\\])/g, "\\$1");
131
126
  return new RegExp("^" + rule.split("*").map(escapeRegex).join(".*") + "$").test(str);
132
127
  }
133
128
 
134
-
135
129
  async function search_anime(search){
136
130
  let filter = "*<ahref=\"/category/*\"title=\"*\">"
137
131
  let html = (await curl("https://gogoanime.dk//search.html?keyword="+search)).split("\n")
@@ -152,7 +146,6 @@ async function search_anime(search){
152
146
  return lines
153
147
  }
154
148
 
155
-
156
149
  async function episode_list(anime_id){
157
150
  let html = (await curl(base_url+"/v1/"+anime_id)).split("\n")
158
151
  let lines = ""
@@ -174,17 +167,15 @@ async function episode_list(anime_id){
174
167
  return json
175
168
  }
176
169
 
177
-
178
170
  async function download(url, name){
179
171
  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
172
  }
181
173
 
182
-
183
- async function selection(options, prompt){
174
+ async function selection(options, prompt, extra_options = []){
184
175
  let selection = 0
185
- while (!(selection <= options && selection > 1)){
176
+ while (true){
186
177
  selection = (await input(prompt))
187
- if (selection <= options && selection >= 1){
178
+ if ((selection <= options && selection >= 1) || extra_options.includes(selection)){
188
179
  break
189
180
  }
190
181
  console.log(colors.Red,`Please input a valid option.`)
@@ -192,7 +183,6 @@ async function selection(options, prompt){
192
183
  return selection
193
184
  }
194
185
 
195
-
196
186
  async function process_search(query) {
197
187
  console.log(colors.Yellow, "Searching: "+query)
198
188
 
@@ -220,15 +210,16 @@ async function process_search(query) {
220
210
  }
221
211
  }
222
212
 
223
-
224
213
  async function get_video_link(episode_dpage){
225
214
  let id = episode_dpage.replace("//gogohd.net/streaming.php?id=","")
226
215
  id = id.slice(0, id.indexOf("="))
227
-
228
- return await generate_link(1,id)
216
+ let link = await generate_link(1,id)
217
+ if (!link){
218
+ link = await generate_link(2,id)
219
+ }
220
+ return link
229
221
  }
230
222
 
231
-
232
223
  async function generate_link(provider, id){
233
224
  let html = ""
234
225
  let provider_name = ""
@@ -255,42 +246,45 @@ async function generate_link(provider, id){
255
246
  post = post.slice(post.indexOf(",\"data\":[{\"file\":\"")+18, post.length)
256
247
  post = post.slice(0, post.indexOf("\"")).replaceAll("\\/","/")
257
248
  return post
258
- /*case 2:
249
+ case 2:
259
250
  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
- */
251
+ let buffer = new Buffer(id)
252
+ let enc_id = buffer.toString("base64")
253
+ buffer = new Buffer(id+"LTXs3GrU8we9O"+enc_id)
254
+ let ani_id = buffer.toString("base64")
255
+ return `${base_url}/api/live${ani_id}`
269
256
 
257
+ /*console.log(`${base_url}/api/live${id}`)
258
+ console.log(colors.Yellow, `Fetching ${provider_name} links...`)
259
+ /*let re="$base_url"
260
+ let links = []
261
+ html = (await curl(`${base_url}/api/live/${"Some variable?"}`)).split("\n") // this needs fixed for alot of bigger titles to work.
262
+ for (x in html){
263
+ console.log(html[x])
264
+ }*/
270
265
 
271
- }
272
- }
273
266
 
274
267
 
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.")
268
+ }
277
269
  }
278
270
 
279
271
  async function post_play(link, anime, player="VLC"){
280
272
  while (true){
281
273
  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;"))
274
+ console.log(colors.Cyan, "1/l) Show Link")
275
+ console.log(colors.Cyan, "2/n) Next Episode")
276
+ console.log(colors.Cyan, "3/p) Prev Episode")
277
+ console.log(colors.Cyan, "4/q) Quit")
278
+ choice = (await selection(4, "select;", ["l", "n", "p", "q"]))
287
279
  switch (choice){
288
- case 1:
280
+ case "l":
281
+ case "1":
289
282
  console.clear()
290
283
  console.log(colors.Blue, "ANI-CLI-NPM \n")
291
284
  console.log(colors.Yellow, "Link: "+link)
292
285
  break
293
- case 2:
286
+ case "n":
287
+ case "2":
294
288
  if (anime.episode_number > anime.episodes.length-2){
295
289
  console.clear()
296
290
  console.log(colors.Red, "Damn, all out of episodes?")
@@ -302,7 +296,8 @@ async function post_play(link, anime, player="VLC"){
302
296
  process.exit()
303
297
  break
304
298
  //EVEN MORE NEEDLESS QUIT STATEMENTS!!!!!!
305
- case 3:
299
+ case "p":
300
+ case "3":
306
301
  if (anime.episode_number < 2){
307
302
  console.clear()
308
303
  console.log(colors.Red, "Error; Episode 0 is only available for premium members")
@@ -313,7 +308,8 @@ async function post_play(link, anime, player="VLC"){
313
308
  await play(link, anime, config.player)
314
309
  process.exit()
315
310
  break
316
- case 4:
311
+ case "q":
312
+ case "4":
317
313
  console.clear()
318
314
  await main()
319
315
  process.exit()
@@ -340,7 +336,6 @@ async function play(link, anime, player="VLC"){
340
336
  }
341
337
  }
342
338
 
343
-
344
339
  async function search(){
345
340
  console.clear()
346
341
  console.log(colors.Blue, "ANI-CLI-NPM \n")
@@ -361,22 +356,29 @@ async function search(){
361
356
  process.exit()
362
357
  }
363
358
  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;"))
359
+ if (link.includes("animixplay.to")){
360
+ console.log(colors.Red, "Warning; VLC compatability for animix.to is currently shaky at best. It is advised to change player to browser in conf")
361
+ }
362
+ console.log(colors.Cyan, "1/p) Play")
363
+ console.log(colors.Cyan, "2/d) Download")
364
+ console.log(colors.Cyan, "3/l) Show Link")
365
+ console.log(colors.Cyan, "4/q) quit")
366
+ choice = (await selection(4, "select;", "q", "d", "l", "q"))
369
367
  switch (choice){
370
- case 1:
368
+ case "p":
369
+ case "1":
371
370
  await play(link, anime, config.player)
372
371
  break
373
- case 2:
372
+ case "d":
373
+ case "2":
374
374
  download(link, anime.anime_id+anime.episode_number+".mp4")
375
375
  break
376
- case 3:
376
+ case "l":
377
+ case "3":
377
378
  console.log(colors.Yellow, "Link: "+link)
378
379
  break
379
- case 4:
380
+ case "q":
381
+ case "4":
380
382
  await main()
381
383
  process.exit()
382
384
  }
@@ -386,16 +388,17 @@ async function search(){
386
388
  console.clear()
387
389
  console.log(colors.Blue, "Welcome to Ani-Cli-npm")
388
390
  async function main(){
389
- console.log(colors.Cyan, "1) Search")
390
- console.log(colors.Cyan, "2) config")
391
- console.log(colors.Cyan, "3) quit")
392
- let choice = parseInt(await input("select;"))
393
-
391
+ console.log(colors.Cyan, "1/s) Search")
392
+ console.log(colors.Cyan, "2/c) config")
393
+ console.log(colors.Cyan, "3/q) quit")
394
+ let choice = await selection(3, "select;", ["s", "c", "q"])
394
395
  switch (choice){
395
- case 1:
396
+ case "s":
397
+ case "1":
396
398
  await search()
397
399
  break
398
- case 2:
400
+ case "c":
401
+ case "2":
399
402
  let temp = structuredClone(config);
400
403
  let exit_code;
401
404
  while (true) {
@@ -417,6 +420,7 @@ async function main(){
417
420
  }
418
421
  await main()
419
422
  break
423
+ case "q":
420
424
  case 3:
421
425
  console.log(colors.Black, "Exiting...")
422
426
  process.exit()
package/gravity/5 ADDED
@@ -0,0 +1 @@
1
+ NDA2ODU