anixartjs 0.1.0 → 0.1.2

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.
@@ -1,5 +1,6 @@
1
1
  import { IProfile } from "./profile";
2
- import { IResponse, IBaseComment, CommentAddResult } from "./response";
2
+ import { IBaseSearchRequest } from "./request";
3
+ import { IResponse, IBaseComment, CommentAddResult, IPageableResponse } from "./response";
3
4
  export interface IChannel {
4
5
  id: number;
5
6
  title: string;
@@ -98,6 +99,7 @@ export interface IArticlePayloadBlock {
98
99
  type: string;
99
100
  }
100
101
  export interface IArticleCreateRequest {
102
+ is_signed: boolean;
101
103
  repost_article_id: number | null;
102
104
  payload: {
103
105
  time: number;
@@ -167,9 +169,12 @@ export interface IChannelBlockInfoResponse extends IResponse<ChannelBlockResult>
167
169
  }
168
170
  export interface IChannelSearchRequest {
169
171
  query: string;
170
- permission: number;
172
+ permission?: number;
171
173
  is_blog: boolean;
172
- is_subscibed: boolean;
174
+ is_subscribed: boolean;
175
+ }
176
+ export interface IArticleSearchRequest extends Omit<IBaseSearchRequest, "searchBy"> {
177
+ channel_id: number;
173
178
  }
174
179
  export interface IArticleComment extends IBaseComment {
175
180
  article: IArticle;
@@ -177,6 +182,19 @@ export interface IArticleComment extends IBaseComment {
177
182
  export interface IChannelMediaTokenResponse extends IResponse<EditorAvaliableResult> {
178
183
  media_upload_token: string;
179
184
  }
185
+ export interface IFeedSearchResponse extends IResponse {
186
+ articles: IPageableResponse<IArticle>;
187
+ channels: IPageableResponse<IChannel>;
188
+ tags: IPageableResponse<string>;
189
+ blogs: IPageableResponse<IChannel>;
190
+ }
191
+ export interface IChannelSubscribersSearchRequest extends IBaseSearchRequest {
192
+ channel_id: number;
193
+ }
194
+ export interface IChannelPermissionManageRequest {
195
+ target_profile_id: number;
196
+ permission: number;
197
+ }
180
198
  export declare enum ArticleCreateEditResult {
181
199
  InvalidRepostArticle = 2,
182
200
  InvalidPayload = 3,
@@ -16,6 +16,10 @@ export interface IFriendNotification extends IBaseNotification {
16
16
  status: string;
17
17
  by_profile: IProfile;
18
18
  }
19
+ export interface IArticleNotification extends IBaseNotification {
20
+ '@id': number;
21
+ article: number;
22
+ }
19
23
  export interface IRelatedReleaseNotification extends IBaseNotification {
20
24
  '@id': number;
21
25
  release: IRelease | number;
@@ -21,7 +21,7 @@ export interface IBookmarkRequest extends IBaseRequestPageable {
21
21
  id: number;
22
22
  type: BookmarkType;
23
23
  sort: BookmarkSortType;
24
- filter: number;
24
+ filter?: number;
25
25
  }
26
26
  export interface IProfileToken {
27
27
  id: string;
@@ -137,6 +137,23 @@ export interface IProfileShort {
137
137
  friend_status: number;
138
138
  friend_count: number;
139
139
  }
140
+ export interface IProfileChannel {
141
+ id: number;
142
+ login: string;
143
+ avatar: string;
144
+ permission_creation_date: number;
145
+ permission: number;
146
+ badge_name: string | null;
147
+ badge_type: number | null;
148
+ badge_url: string | null;
149
+ is_blocked: boolean;
150
+ is_sponsor: boolean;
151
+ is_verified: boolean;
152
+ is_perm_blocked: boolean;
153
+ channel_id: number;
154
+ block_reason: string | null;
155
+ block_expire_date: number | null;
156
+ }
140
157
  export interface IProfileResponse extends IResponse {
141
158
  profile: IProfile;
142
159
  is_my_profile: boolean;
@@ -186,3 +203,6 @@ export declare enum AchivementResult {
186
203
  AlreadyGranted = 2,
187
204
  AchivementNotFound = 3
188
205
  }
206
+ export declare enum BlocklistAddResult {
207
+ AlreadyInBlocklist = 2
208
+ }
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  //Thanks Nekonyx for this types (https://github.com/Nekonyx/anixart-api/blob/master/src/contracts/profile.ts)
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.AchivementResult = exports.RemoveFriendRequestResult = exports.SendFriendRequestResult = exports.BookmarkSortType = exports.BookmarkType = void 0;
4
+ exports.BlocklistAddResult = exports.AchivementResult = exports.RemoveFriendRequestResult = exports.SendFriendRequestResult = exports.BookmarkSortType = exports.BookmarkType = void 0;
5
5
  var BookmarkType;
6
6
  (function (BookmarkType) {
7
7
  BookmarkType[BookmarkType["Watching"] = 1] = "Watching";
@@ -40,3 +40,7 @@ var AchivementResult;
40
40
  AchivementResult[AchivementResult["AlreadyGranted"] = 2] = "AlreadyGranted";
41
41
  AchivementResult[AchivementResult["AchivementNotFound"] = 3] = "AchivementNotFound";
42
42
  })(AchivementResult || (exports.AchivementResult = AchivementResult = {}));
43
+ var BlocklistAddResult;
44
+ (function (BlocklistAddResult) {
45
+ BlocklistAddResult[BlocklistAddResult["AlreadyInBlocklist"] = 2] = "AlreadyInBlocklist";
46
+ })(BlocklistAddResult || (exports.BlocklistAddResult = BlocklistAddResult = {}));
@@ -1,6 +1,6 @@
1
1
  import { IPageableResponse, IResponse, IBaseComment, CommentAddResult } from './response';
2
- import { IProfile } from './profile';
3
- import { IBaseRequestPageable } from './request';
2
+ import { IProfile, BookmarkType } from './profile';
3
+ import { IBaseRequestPageable, IBaseSearchRequest } from './request';
4
4
  export declare enum ReleaseCategory {
5
5
  Unknown = 0,
6
6
  Series = 1,
@@ -314,3 +314,6 @@ export interface IExportRelease {
314
314
  profile_list_status: number;
315
315
  is_favorite: boolean;
316
316
  }
317
+ export interface IReleasesInBookmarksSearchRequest extends IBaseSearchRequest {
318
+ type: BookmarkType;
319
+ }
@@ -59,9 +59,6 @@ export declare enum ChangeLoginResult {
59
59
  LoginAlreadyTaken = 3,
60
60
  TimeLimit = 4
61
61
  }
62
- export declare enum BlocklistAddResult {
63
- AlreadyInBlocklist = 2
64
- }
65
62
  export declare enum ChangeEmailResult {
66
63
  InvalidEmail = 2,
67
64
  InvalidCurrentEmail = 3,
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PrivacyFriendRequestState = exports.PrivacyState = exports.PasswordChangeResult = exports.ChangePasswordResult = exports.ChangeEmailConfirmResult = exports.ChangeEmailResult = exports.BlocklistAddResult = exports.ChangeLoginResult = exports.SocialEditResult = void 0;
3
+ exports.PrivacyFriendRequestState = exports.PrivacyState = exports.PasswordChangeResult = exports.ChangePasswordResult = exports.ChangeEmailConfirmResult = exports.ChangeEmailResult = exports.ChangeLoginResult = exports.SocialEditResult = void 0;
4
4
  var SocialEditResult;
5
5
  (function (SocialEditResult) {
6
6
  SocialEditResult[SocialEditResult["InvalidVk"] = 2] = "InvalidVk";
@@ -15,10 +15,6 @@ var ChangeLoginResult;
15
15
  ChangeLoginResult[ChangeLoginResult["LoginAlreadyTaken"] = 3] = "LoginAlreadyTaken";
16
16
  ChangeLoginResult[ChangeLoginResult["TimeLimit"] = 4] = "TimeLimit";
17
17
  })(ChangeLoginResult || (exports.ChangeLoginResult = ChangeLoginResult = {}));
18
- var BlocklistAddResult;
19
- (function (BlocklistAddResult) {
20
- BlocklistAddResult[BlocklistAddResult["AlreadyInBlocklist"] = 2] = "AlreadyInBlocklist";
21
- })(BlocklistAddResult || (exports.BlocklistAddResult = BlocklistAddResult = {}));
22
18
  var ChangeEmailResult;
23
19
  (function (ChangeEmailResult) {
24
20
  ChangeEmailResult[ChangeEmailResult["InvalidEmail"] = 2] = "InvalidEmail";
@@ -26,10 +26,12 @@ export interface IArticleEmbedBlockBuilder {
26
26
  }
27
27
  export declare class ArticleBuilder {
28
28
  private blocks;
29
+ private isSigned;
29
30
  private repostArticleId;
30
31
  private readonly maxBlockCount;
31
32
  private generateUniqueId;
32
33
  returnBuildAricle(): IArticleCreateRequest;
34
+ setSignedState(isSigned: boolean): ArticleBuilder;
33
35
  setRepostArticle(article: Article | number): ArticleBuilder;
34
36
  addBlock(data: IArticleTextBlockBuilder | IArticleQuoteBlockBuilder | IArticleListBlockBuilder | IArticleDelimiterBlockBuilder | IArticleImageBlockBuilder | IArticleEmbedBlockBuilder): ArticleBuilder;
35
37
  addBlocks(data: (IArticleTextBlockBuilder | IArticleQuoteBlockBuilder | IArticleListBlockBuilder | IArticleDelimiterBlockBuilder | IArticleImageBlockBuilder | IArticleEmbedBlockBuilder)[]): ArticleBuilder;
@@ -5,6 +5,7 @@ const Article_1 = require("../classes/Article");
5
5
  class ArticleBuilder {
6
6
  constructor() {
7
7
  this.blocks = [];
8
+ this.isSigned = false;
8
9
  this.repostArticleId = null;
9
10
  this.maxBlockCount = 25;
10
11
  }
@@ -18,6 +19,7 @@ class ArticleBuilder {
18
19
  }
19
20
  returnBuildAricle() {
20
21
  return {
22
+ is_signed: this.isSigned,
21
23
  repost_article_id: this.repostArticleId,
22
24
  payload: {
23
25
  time: Date.now(),
@@ -27,6 +29,10 @@ class ArticleBuilder {
27
29
  }
28
30
  };
29
31
  }
32
+ setSignedState(isSigned) {
33
+ this.isSigned = isSigned;
34
+ return this;
35
+ }
30
36
  setRepostArticle(article) {
31
37
  this.repostArticleId = article instanceof Article_1.Article ? article.id : article;
32
38
  return this;
@@ -55,38 +55,145 @@ export declare class KodikParser {
55
55
  * Парсер источника Libria
56
56
  */
57
57
  /**
58
- * Полученный обьект Файлов
58
+ * Тайтл
59
59
  */
60
- export interface AniLibriaFile {
61
- id: string;
62
- skip: boolean;
63
- file: string;
64
- title: string;
65
- poster: string;
66
- download: string;
60
+ export interface AniLibriaAnime {
61
+ id: number;
62
+ type: {
63
+ value: string;
64
+ description: string;
65
+ };
66
+ year: number;
67
+ name: {
68
+ main: string;
69
+ english: string;
70
+ alternative: string;
71
+ };
72
+ alias: string;
73
+ season: {
74
+ value: string;
75
+ description: string;
76
+ };
77
+ poster: {
78
+ src: string;
79
+ preview: string;
80
+ thumbnail: string;
81
+ optimized: {
82
+ src: string;
83
+ preview: string;
84
+ thumbnail: string;
85
+ };
86
+ };
87
+ fresh_at: string;
88
+ created_at: string;
89
+ updated_at: string;
90
+ is_ongoing: boolean;
91
+ age_rating: {
92
+ value: string;
93
+ description: string;
94
+ label: string;
95
+ is_adult: boolean;
96
+ };
97
+ publish_day: {
98
+ value: string;
99
+ description: string;
100
+ };
101
+ description: string;
102
+ notification: any;
103
+ episodes_count: number | null;
104
+ external_player: any;
105
+ is_in_production: boolean;
106
+ is_blocked_by_geo: boolean;
107
+ is_blocked_by_copyrights: boolean;
108
+ added_in_users_favorites: number;
109
+ average_duration_of_episode: any;
110
+ added_in_planned_collection: number;
111
+ added_in_watched_collection: number;
112
+ added_in_watching_collection: number;
113
+ added_in_postponed_collection: number;
114
+ added_in_abandoned_collection: number;
115
+ genres: AniLibriaGenre[];
116
+ members: AniLibriaMember[];
117
+ sponsor: {
118
+ id: string;
119
+ title: string;
120
+ description: string;
121
+ url_title: string;
122
+ url: string;
123
+ };
124
+ episodes: AniLibriaEpisode[];
67
125
  }
68
126
  /**
69
- * Ссылка на файл
127
+ * Жанр
70
128
  */
71
- export interface AniLibriaLink {
72
- src: string;
129
+ export interface AniLibriaGenre {
130
+ id: number;
131
+ name: string;
132
+ image: {
133
+ preview: string;
134
+ thumbnail: string;
135
+ optimized: {
136
+ preview: string;
137
+ thumbnail: string;
138
+ };
139
+ };
140
+ total_releases: number;
141
+ }
142
+ /**
143
+ * Участник Anilibria
144
+ */
145
+ export interface AniLibriaMember {
146
+ id: string;
147
+ role: {
148
+ value: string;
149
+ description: string;
150
+ };
151
+ nickname: string;
152
+ user: any;
73
153
  }
74
154
  /**
75
- * Обьект файла
155
+ * Эпизод
76
156
  */
77
- export interface AniLibriaFileObject {
157
+ export interface AniLibriaEpisode {
78
158
  id: string;
79
- skip: boolean;
80
- file: Record<string, AniLibriaLink>;
81
- title: string;
82
- poster: string;
83
- download: string;
159
+ name: string | null;
160
+ ordinal: number;
161
+ opening: {
162
+ stop: number | null;
163
+ start: number | null;
164
+ };
165
+ ending: {
166
+ stop: number | null;
167
+ start: number | null;
168
+ };
169
+ preview: {
170
+ src: string;
171
+ preview: string;
172
+ thumbnail: string;
173
+ optimized: {
174
+ src: string;
175
+ preview: string;
176
+ thumbnail: string;
177
+ };
178
+ };
179
+ hls_480: string;
180
+ hls_720: string;
181
+ hls_1080: string;
182
+ duration: number;
183
+ rutube_id: any;
184
+ youtube_id: any;
185
+ updated_at: string;
186
+ sort_order: number;
187
+ release_id: number;
188
+ name_english: string | null;
84
189
  }
85
190
  /**
86
191
  * Возвращаемый обьект
87
192
  */
88
193
  export interface AniLibriaReturnObject {
89
- files: AniLibriaFileObject[];
194
+ [key: string]: {
195
+ src: string;
196
+ };
90
197
  }
91
198
  /**
92
199
  * Класс парсера анилибрии
@@ -94,8 +201,8 @@ export interface AniLibriaReturnObject {
94
201
  export declare class AniLibriaParser {
95
202
  private static _baseAniLibriaDomain;
96
203
  private static _endpointUrl;
97
- static settingsPattern: RegExp;
98
- static filesPattern: RegExp;
204
+ static idPattern: RegExp;
205
+ static episodePattern: RegExp;
99
206
  static getDirectLinks(link: string): Promise<AniLibriaReturnObject | null>;
100
207
  }
101
208
  /**
@@ -65,38 +65,35 @@ KodikParser._endpointUrl = '/ftor';
65
65
  */
66
66
  class AniLibriaParser {
67
67
  static async getDirectLinks(link) {
68
- const request = await fetch(link);
69
- let body = await request.text();
70
- let match = this.settingsPattern.exec(body);
71
- if (match) {
72
- let originalObject = JSON.parse(match[0]);
73
- let returnedObject = {
74
- files: [],
75
- };
76
- for (let x of originalObject) {
77
- let res = {
78
- ...x,
79
- file: {}
80
- };
81
- let filesMatch = x.file.match(this.filesPattern);
82
- for (let y of filesMatch) {
83
- let link = y.replace('[', '').split(']');
84
- res.file[link[0].replace("p", "")] = {
85
- src: link[1]
86
- };
68
+ var _a, _b, _c, _d, _e;
69
+ const id = (_b = (_a = this.idPattern.exec(link)) === null || _a === void 0 ? void 0 : _a.groups) === null || _b === void 0 ? void 0 : _b.id;
70
+ const episode = (_d = (_c = this.episodePattern.exec(link)) === null || _c === void 0 ? void 0 : _c.groups) === null || _d === void 0 ? void 0 : _d.ep;
71
+ const request = await fetch(`https://${this._baseAniLibriaDomain}${this._endpointUrl}/${id}`);
72
+ let body = await request.json();
73
+ if (!body || typeof episode != 'string')
74
+ return null;
75
+ const ep = (_e = body.episodes.find(e => e.ordinal == parseInt(episode))) !== null && _e !== void 0 ? _e : null;
76
+ if (ep) {
77
+ return {
78
+ "1080": {
79
+ src: ep.hls_1080
80
+ },
81
+ "720": {
82
+ src: ep.hls_720
83
+ },
84
+ "480": {
85
+ src: ep.hls_480
87
86
  }
88
- returnedObject.files.push(res);
89
- }
90
- return returnedObject;
87
+ };
91
88
  }
92
89
  return null;
93
90
  }
94
91
  }
95
92
  exports.AniLibriaParser = AniLibriaParser;
96
- AniLibriaParser._baseAniLibriaDomain = 'anixart.libria.fun';
97
- AniLibriaParser._endpointUrl = '/public/iframe.php';
98
- AniLibriaParser.settingsPattern = new RegExp(/\[{.*?}\]/g);
99
- AniLibriaParser.filesPattern = new RegExp(/\[.*?\].*?(,|isAuthorized=\d)/g);
93
+ AniLibriaParser._baseAniLibriaDomain = 'anilibria.top';
94
+ AniLibriaParser._endpointUrl = '/api/v1/anime/releases';
95
+ AniLibriaParser.idPattern = new RegExp(/id=(?<id>\d+)/g);
96
+ AniLibriaParser.episodePattern = new RegExp(/ep=(?<ep>\d+)/g);
100
97
  /**
101
98
  * SibnetParser
102
99
  * Парсер источника Sibnet
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "anixartjs",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Anixart API Wrapper for NodeJS",
5
5
  "type": "commonjs",
6
6
  "main": "dist/index.js",