anixartjs 0.0.2 → 0.0.3

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/dist/client.js CHANGED
@@ -90,11 +90,13 @@ class Anixart {
90
90
  break;
91
91
  case (request.image !== null && request.image !== undefined):
92
92
  const formData = new form_data_1.default();
93
- formData.append(request.image.type, new Blob([request.image.stream]), request.image.name);
93
+ formData.append(request.image.type, request.image.stream, {
94
+ filename: request.image.name
95
+ });
94
96
  if (request.image.boundary) {
95
97
  formData.setBoundary(request.image.boundary);
96
98
  }
97
- headers['Content-Length'] = String(formData);
99
+ headers['Content-Length'] = String(formData.getLengthSync());
98
100
  requestInit.body = formData.getBuffer();
99
101
  requestInit.headers = formData.getHeaders(headers);
100
102
  break;
@@ -110,7 +112,7 @@ class Anixart {
110
112
  data = await response.text();
111
113
  }
112
114
  catch (error) {
113
- throw new Error(`[AnixartJS] Unexpected error: ${error}`);
115
+ throw new Error(`[AnixartJS] Unexpected error: ${error.stack}`);
114
116
  }
115
117
  if (data.trim() == "") {
116
118
  throw new Error("[AnixartJS] Bad Request");
@@ -69,8 +69,7 @@ export interface AniLibriaFile {
69
69
  * Ссылка на файл
70
70
  */
71
71
  export interface AniLibriaLink {
72
- quality: string;
73
- url: string;
72
+ src: string;
74
73
  }
75
74
  /**
76
75
  * Обьект файла
@@ -78,7 +77,7 @@ export interface AniLibriaLink {
78
77
  export interface AniLibriaFileObject {
79
78
  id: string;
80
79
  skip: boolean;
81
- file: AniLibriaLink[];
80
+ file: Record<string, AniLibriaLink>;
82
81
  title: string;
83
82
  poster: string;
84
83
  download: string;
@@ -76,12 +76,14 @@ class AniLibriaParser {
76
76
  for (let x of originalObject) {
77
77
  let res = {
78
78
  ...x,
79
- file: []
79
+ file: {}
80
80
  };
81
81
  let filesMatch = x.file.match(this.filesPattern);
82
82
  for (let y of filesMatch) {
83
83
  let link = y.replace('[', '').split(']');
84
- res.file.push({ quality: link[0], url: link[1] });
84
+ res.file[link[0].replace("p", "")] = {
85
+ src: link[1]
86
+ };
85
87
  }
86
88
  returnedObject.files.push(res);
87
89
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "anixartjs",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "description": "Anixart API Wrapper for NodeJS",
5
5
  "type": "commonjs",
6
6
  "main": "dist/index.js",