anixartjs 0.1.1 → 0.1.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/types/channel.d.ts
CHANGED
|
@@ -99,6 +99,7 @@ export interface IArticlePayloadBlock {
|
|
|
99
99
|
type: string;
|
|
100
100
|
}
|
|
101
101
|
export interface IArticleCreateRequest {
|
|
102
|
+
is_signed: boolean;
|
|
102
103
|
repost_article_id: number | null;
|
|
103
104
|
payload: {
|
|
104
105
|
time: number;
|
|
@@ -130,7 +131,7 @@ export interface IArticleCreateResponse extends IResponse<ArticleCreateEditResul
|
|
|
130
131
|
export interface IArticle {
|
|
131
132
|
id: number;
|
|
132
133
|
channel: IChannel;
|
|
133
|
-
author: IProfile;
|
|
134
|
+
author: IProfile | null;
|
|
134
135
|
payload: {
|
|
135
136
|
time: number;
|
|
136
137
|
blocks: IArticlePayloadBlock[];
|
package/dist/types/release.d.ts
CHANGED
|
@@ -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
|
|
61
|
-
id:
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
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
|
|
72
|
-
|
|
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
|
|
157
|
+
export interface AniLibriaEpisode {
|
|
78
158
|
id: string;
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
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
|
-
|
|
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
|
|
98
|
-
static
|
|
204
|
+
static idPattern: RegExp;
|
|
205
|
+
static episodePattern: RegExp;
|
|
99
206
|
static getDirectLinks(link: string): Promise<AniLibriaReturnObject | null>;
|
|
100
207
|
}
|
|
101
208
|
/**
|
package/dist/utils/LinkParser.js
CHANGED
|
@@ -65,38 +65,35 @@ KodikParser._endpointUrl = '/ftor';
|
|
|
65
65
|
*/
|
|
66
66
|
class AniLibriaParser {
|
|
67
67
|
static async getDirectLinks(link) {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
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
|
-
|
|
89
|
-
}
|
|
90
|
-
return returnedObject;
|
|
87
|
+
};
|
|
91
88
|
}
|
|
92
89
|
return null;
|
|
93
90
|
}
|
|
94
91
|
}
|
|
95
92
|
exports.AniLibriaParser = AniLibriaParser;
|
|
96
|
-
AniLibriaParser._baseAniLibriaDomain = '
|
|
97
|
-
AniLibriaParser._endpointUrl = '/
|
|
98
|
-
AniLibriaParser.
|
|
99
|
-
AniLibriaParser.
|
|
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
|