anixartjs 0.0.1 → 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/README.md CHANGED
@@ -1,3 +1,6 @@
1
+ > [!WARNING]
2
+ > Данный проект был сделан в ознакомительных целях. Автор осуждает и не поддерживает создание авторегов, ботов для накрутки лайков, спам ботов и любых других проектов нацеленых на абуз и злоупотребление API Anixart.
3
+
1
4
  <h2 align="center">AnixartJS</h2>
2
5
 
3
6
  AnixartJS — это имплементация **API Anixart** на **TypeScript** для NodeJS, предоставляющая удобный и интуитивно понятный интерфейс для взаимодействия с приложением Anixart.
@@ -171,6 +174,7 @@ if (release) {
171
174
  - [ ] Добавление всех эндпоинтов
172
175
  - [ ] Добавление классов для коллекций
173
176
  - [ ] Документация
177
+ - [ ] Возможность использовать библиотеку в браузере полностью
174
178
 
175
179
  ## 🤝 Вклад в проект
176
180
 
@@ -1,5 +1,5 @@
1
1
  import { Anixart } from "../client";
2
- import { IProfileResponse, IBookmarkRequest, IFriendsRequest, IProfileShort, IFriendRequestResponse, IBaseApiParams, IBaseSearchRequest, IPageableResponse, IRelease, IProfile, IResponse, ISubsciptionCountResponse } from "../types";
2
+ import { IProfileResponse, IBookmarkRequest, IFriendsRequest, IProfileShort, IFriendRequestResponse, IBaseApiParams, IBaseSearchRequest, IPageableResponse, IRelease, IProfile, IResponse, ISubsciptionCountResponse, IVoteRelease } from "../types";
3
3
  /**
4
4
  * Класс профиля
5
5
  *
@@ -22,5 +22,5 @@ export declare class Profile {
22
22
  getFavorites(data: IBookmarkRequest, options?: IBaseApiParams): Promise<IPageableResponse<IRelease>>;
23
23
  getSubsciptions(page: number, options?: IBaseApiParams): Promise<IPageableResponse<any>>;
24
24
  getSubscriptionCount(options?: IBaseApiParams): Promise<ISubsciptionCountResponse>;
25
- getVotesReleases(id: number, page: number, sort?: number, options?: IBaseApiParams): Promise<IPageableResponse<IProfileShort>>;
25
+ getVotesReleases(id: number, page: number, sort?: number, options?: IBaseApiParams): Promise<IPageableResponse<IVoteRelease>>;
26
26
  }
@@ -1,5 +1,5 @@
1
1
  import { Anixart } from "../client";
2
- import { IFriendRequestResponse, IProfileShort } from "../types";
2
+ import { IFriendRequestResponse, IPageableResponse, IProfileShort, IVoteRelease } from "../types";
3
3
  export declare class BaseProfile {
4
4
  protected readonly client: Anixart;
5
5
  readonly id: number;
@@ -22,4 +22,5 @@ export declare class BaseProfile {
22
22
  getFriends(page?: number): Promise<BaseProfile[]>;
23
23
  sendFriendRequest(): Promise<IFriendRequestResponse>;
24
24
  removeFriendRequest(): Promise<IFriendRequestResponse>;
25
+ getVotesReleases(page?: number, sort?: number): Promise<IPageableResponse<IVoteRelease>>;
25
26
  }
@@ -33,5 +33,9 @@ class BaseProfile {
33
33
  const request = await this.client.endpoints.profile.removeFriendRequest(this.id);
34
34
  return request;
35
35
  }
36
+ async getVotesReleases(page, sort) {
37
+ const request = await this.client.endpoints.profile.getVotesReleases(this.id, page !== null && page !== void 0 ? page : 0, sort !== null && sort !== void 0 ? sort : 1);
38
+ return request;
39
+ }
36
40
  }
37
41
  exports.BaseProfile = BaseProfile;
@@ -1,13 +1,13 @@
1
1
  import { Anixart } from "../client";
2
2
  import { BaseProfile } from "./BaseProfile";
3
- import { IProfile, IRole } from "../types";
3
+ import { IProfile, IRole, IVoteRelease, IWatchDynamics } from "../types";
4
4
  import { Release } from "./Release";
5
5
  export declare class FullProfile extends BaseProfile {
6
6
  readonly client: Anixart;
7
7
  readonly status: string;
8
8
  readonly sponsorshipExpires: number;
9
9
  readonly history: Release[];
10
- readonly votes: Release[];
10
+ readonly votes: IVoteRelease[];
11
11
  readonly lastActivityTime: number;
12
12
  readonly registerDate: number;
13
13
  readonly vkPage: string;
@@ -39,7 +39,7 @@ export declare class FullProfile extends BaseProfile {
39
39
  readonly isReportProcessNotificationsEnabled: boolean;
40
40
  readonly isCommentNotificationsEnabled: boolean;
41
41
  readonly isMyCollectionCommentNotificationsEnabled: boolean;
42
- readonly watchDynamics: any[];
42
+ readonly watchDynamics: IWatchDynamics[];
43
43
  readonly ratingScore: number;
44
44
  readonly isPermBanned: boolean;
45
45
  readonly isBlocked: boolean;
@@ -28,7 +28,7 @@ class FullProfile extends BaseProfile_1.BaseProfile {
28
28
  this.status = profile.status;
29
29
  this.sponsorshipExpires = profile.sponsorshipExpires;
30
30
  this.history = profile.history.map(release => new Release_1.Release(this.client, release));
31
- this.votes = profile.votes.map(release => new Release_1.Release(this.client, release));
31
+ this.votes = profile.votes;
32
32
  this.lastActivityTime = profile.last_activity_time;
33
33
  this.registerDate = profile.register_date;
34
34
  this.vkPage = profile.vk_page;
@@ -1,5 +1,5 @@
1
1
  import { Anixart } from "../client";
2
- import { BookmarkType, IBaseCommentAddRequest, IEpisodeLastUpdate, IRelated, IRelease, IReleaseCategory, IReleaseStatus, ResponseCode } from "../types";
2
+ import { BookmarkType, IBaseCommentAddRequest, ICommentRelease, IEpisodeLastUpdate, IRelated, IRelease, IReleaseCategory, IReleaseStatus, IVideoBanners, ResponseCode } from "../types";
3
3
  import { Dubber } from "./Dubber";
4
4
  import { ReleaseComment } from "./ReleaseComment";
5
5
  export declare class Release {
@@ -24,11 +24,11 @@ export declare class Release {
24
24
  readonly duration: number;
25
25
  readonly season: number;
26
26
  readonly broadcast: number;
27
- readonly screenshots: any[];
28
- readonly comments: any[];
27
+ readonly screenshots: string[];
28
+ readonly comments: ICommentRelease[];
29
29
  readonly titleOriginal: string;
30
30
  readonly titleRu: string;
31
- readonly titleAlt: null;
31
+ readonly titleAlt: string;
32
32
  readonly episodesReleased: number;
33
33
  readonly episodesTotal: number;
34
34
  readonly releaseDate: string;
@@ -66,12 +66,12 @@ export declare class Release {
66
66
  readonly isViewed: boolean;
67
67
  readonly isFavorite: boolean;
68
68
  readonly isViewBlocked: boolean;
69
- readonly screenshotImages: any[];
69
+ readonly screenshotImages: string[];
70
70
  readonly relatedReleases: Release[] | null;
71
71
  readonly recommendedReleases: Release[];
72
72
  readonly episodeLastUpdate: IEpisodeLastUpdate;
73
73
  readonly commentPerDayCount: number;
74
- readonly videoBanners: any[];
74
+ readonly videoBanners: IVideoBanners[];
75
75
  readonly profileReleaseTypeNotificationPreferenceCount: number;
76
76
  readonly isReleaseTypeNotificationsEnabled: boolean;
77
77
  constructor(client: Anixart, releaseResponse: IRelease);
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");
@@ -1,5 +1,6 @@
1
1
  import { IResponse } from "./response";
2
2
  import { IBaseRequestPageable } from "./request";
3
+ import { IRelease, IVoteRelease } from "./release";
3
4
  export declare enum BookmarkType {
4
5
  Watching = 1,
5
6
  InPlans = 2,
@@ -32,8 +33,8 @@ export interface IProfile {
32
33
  avatar: string;
33
34
  status: string;
34
35
  sponsorshipExpires: number;
35
- history: any[];
36
- votes: any[];
36
+ history: IRelease[];
37
+ votes: IVoteRelease[];
37
38
  last_activity_time: number;
38
39
  register_date: number;
39
40
  vk_page: string;
@@ -73,7 +74,7 @@ export interface IProfile {
73
74
  is_comment_notifications_enabled: boolean;
74
75
  is_my_collection_comment_notifications_enabled: boolean;
75
76
  is_verified: boolean;
76
- watch_dynamics: any[];
77
+ watch_dynamics: IWatchDynamics[];
77
78
  friend_status: number;
78
79
  rating_score: number;
79
80
  is_blocked: boolean;
@@ -86,6 +87,12 @@ export interface IProfile {
86
87
  roles: IRole[];
87
88
  badge: IBadge | null;
88
89
  }
90
+ export interface IWatchDynamics {
91
+ id: number;
92
+ day: number;
93
+ count: number;
94
+ timestamp: number;
95
+ }
89
96
  export interface IRole {
90
97
  color: string;
91
98
  name: string;
@@ -94,11 +94,11 @@ export interface IRelease {
94
94
  duration: number;
95
95
  season: number;
96
96
  broadcast: number;
97
- screenshots: any[];
97
+ screenshots: string[];
98
98
  comments: ICommentRelease[];
99
99
  title_original: string;
100
100
  title_ru: string;
101
- title_alt: null;
101
+ title_alt: string;
102
102
  episodes_released: number;
103
103
  episodes_total: number;
104
104
  release_date: string;
@@ -136,15 +136,50 @@ export interface IRelease {
136
136
  is_viewed: boolean;
137
137
  is_favorite: boolean;
138
138
  is_view_blocked: boolean;
139
- screenshot_images: any[];
139
+ screenshot_images: string[];
140
140
  related_releases: IRelease[];
141
141
  recommended_releases: IRelease[];
142
142
  episode_last_update: IEpisodeLastUpdate;
143
143
  comment_per_day_count: number;
144
- video_banners: any[];
144
+ video_banners: IVideoBanners[];
145
145
  profile_release_type_notification_preference_count: number;
146
146
  is_release_type_notifications_enabled: boolean;
147
147
  }
148
+ export interface IVoteRelease {
149
+ translation: string;
150
+ id: number;
151
+ broadcast: number;
152
+ year: string;
153
+ country: string;
154
+ duration: number;
155
+ description: string;
156
+ image: string;
157
+ genres: string;
158
+ studio: string;
159
+ season: number;
160
+ note: string | null;
161
+ author: string;
162
+ director: string;
163
+ rating: number;
164
+ grade: number;
165
+ status: number;
166
+ title_original: string;
167
+ title_ru: string;
168
+ favorites_count: number;
169
+ creation_date: number;
170
+ last_update_date: number;
171
+ is_deleted: boolean;
172
+ is_favorite: boolean;
173
+ is_viewed: boolean;
174
+ is_play_disabled: boolean;
175
+ is_adult: boolean;
176
+ my_vote: number;
177
+ episodes_released: number;
178
+ episodes_total: number;
179
+ release_date: string;
180
+ age_rating: number;
181
+ profile_list_status: number;
182
+ }
148
183
  export interface IVideo {
149
184
  id: number;
150
185
  release: IRelease | number;
@@ -169,10 +204,24 @@ export interface IVideo {
169
204
  export interface IVideoResponse extends IResponse {
170
205
  release: IRelease;
171
206
  blocks: IVideo[];
172
- streaming_platforms: any[];
207
+ streaming_platforms: IVideoStreamingPlatform[];
173
208
  last_videos: IVideo[];
174
209
  can_appeal: boolean;
175
210
  }
211
+ export interface IVideoBanners {
212
+ name: string;
213
+ image: string;
214
+ value: string;
215
+ action_id: number;
216
+ is_new: boolean;
217
+ }
218
+ export interface IVideoStreamingPlatform {
219
+ id: number;
220
+ name: string;
221
+ icon: string;
222
+ url: string;
223
+ position: number;
224
+ }
176
225
  export interface IReleaseResponse extends IResponse {
177
226
  release: IRelease;
178
227
  }
@@ -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;
@@ -26,6 +26,7 @@ class KodikParser {
26
26
  const videoInfoHash = (_e = (_d = urlResponse.match(/videoInfo.hash\s=\s'(?<hash>.*?)';/is)) === null || _d === void 0 ? void 0 : _d.groups) === null || _e === void 0 ? void 0 : _e.hash;
27
27
  const videoInfoId = (_g = (_f = urlResponse.match(/videoInfo.id\s=\s'(?<id>.*?)';/is)) === null || _f === void 0 ? void 0 : _f.groups) === null || _g === void 0 ? void 0 : _g.id;
28
28
  const videoInfoType = (_j = (_h = urlResponse.match(/videoInfo.type\s=\s'(?<type>.*?)';/)) === null || _h === void 0 ? void 0 : _h.groups) === null || _j === void 0 ? void 0 : _j.type;
29
+ const validKodikUrl = new RegExp(/\/\/(get|cloud)\.kodik-storage\.com\/useruploads\/.*?\/.*?\/(240|360|480|720|1080)\.mp4:hls:manifest.m3u8/s);
29
30
  if (!videoInfoHash || !videoInfoId || !videoInfoType)
30
31
  return null;
31
32
  const requestBody = {
@@ -44,9 +45,11 @@ class KodikParser {
44
45
  const zCharCode = 'Z'.charCodeAt(0);
45
46
  for (const [, sources] of Object.entries(directLinks.links)) {
46
47
  for (const source of sources) {
48
+ if (validKodikUrl.test(source.src))
49
+ continue;
47
50
  const decryptedBase64 = source.src.replace(/[a-zA-Z]/g, e => {
48
51
  let eCharCode = e.charCodeAt(0);
49
- return String.fromCharCode((eCharCode <= zCharCode ? 90 : 122) >= (eCharCode = eCharCode + 13) ? eCharCode : eCharCode - 26);
52
+ return String.fromCharCode((eCharCode <= zCharCode ? 90 : 122) >= (eCharCode = eCharCode + 18) ? eCharCode : eCharCode - 26);
50
53
  });
51
54
  source.src = atob(decryptedBase64);
52
55
  }
@@ -73,12 +76,14 @@ class AniLibriaParser {
73
76
  for (let x of originalObject) {
74
77
  let res = {
75
78
  ...x,
76
- file: []
79
+ file: {}
77
80
  };
78
81
  let filesMatch = x.file.match(this.filesPattern);
79
82
  for (let y of filesMatch) {
80
83
  let link = y.replace('[', '').split(']');
81
- res.file.push({ quality: link[0], url: link[1] });
84
+ res.file[link[0].replace("p", "")] = {
85
+ src: link[1]
86
+ };
82
87
  }
83
88
  returnedObject.files.push(res);
84
89
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "anixartjs",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
4
  "description": "Anixart API Wrapper for NodeJS",
5
5
  "type": "commonjs",
6
6
  "main": "dist/index.js",