anixartjs 0.1.7 → 0.1.8
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/api/channel.d.ts +4 -1
- package/dist/api/channel.js +9 -0
- package/dist/api/profile.d.ts +76 -1
- package/dist/api/profile.js +168 -15
- package/dist/classes/BaseProfile.d.ts +1 -1
- package/dist/classes/FullProfile.d.ts +0 -1
- package/dist/classes/FullProfile.js +0 -1
- package/dist/types/channel.d.ts +11 -0
- package/dist/types/channel.js +8 -1
- package/dist/types/profile.d.ts +58 -5
- package/dist/utils/LinkParser.d.ts +37 -0
- package/dist/utils/LinkParser.js +137 -5
- package/package.json +1 -1
package/dist/api/channel.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Anixart } from "../client";
|
|
2
|
-
import { IPageableResponse, IResponse, IBaseApiParams, IChannelResponse, IChannel, IArticle, IArticleCreateRequest, IArticleCreateResponse, IChannelCreateRequest, IProfileShort, IArticleCommentResponce, IArticleComment, IBaseCommentAddRequest, IChannelMediaTokenResponse, VoteType, IArticleUploadFileResponse, IUrlResponse, IEmbedData, IArticleResponse, IArticleSuggestionPublishResponse, IArticleSuggestionCreateRequest, IChannelBlockManageRequest, IChannelBlockInfoResponse, ArticleCreateEditResult, ChannelSubscribeResult, ChannelUnsubscribeResult, ChannelCreateEditResult, ArticleDeleteResult, CommentDeleteResult, ChannelBlockResult, ArticleSuggestionDeleteResult, IProfileChannel, BlogCreateResult, ChannelPermissionManageResult, IChannelPermissionManageRequest } from "../types";
|
|
2
|
+
import { IPageableResponse, IResponse, IBaseApiParams, IChannelResponse, IChannel, IArticle, IArticleCreateRequest, IArticleCreateResponse, IChannelCreateRequest, IProfileShort, IArticleCommentResponce, IArticleComment, IBaseCommentAddRequest, IChannelMediaTokenResponse, VoteType, IArticleUploadFileResponse, IUrlResponse, IEmbedData, IArticleResponse, IArticleSuggestionPublishResponse, IArticleSuggestionCreateRequest, IChannelBlockManageRequest, IChannelBlockInfoResponse, ArticleCreateEditResult, ChannelSubscribeResult, ChannelUnsubscribeResult, ChannelCreateEditResult, ArticleDeleteResult, CommentDeleteResult, ChannelBlockResult, ArticleSuggestionDeleteResult, IProfileChannel, BlogCreateResult, ChannelPermissionManageResult, IChannelPermissionManageRequest, ArticleEditPinnedResult, IArticleEventRequest } from "../types";
|
|
3
3
|
/**
|
|
4
4
|
* Это из беты аниксарта 9.0
|
|
5
5
|
*
|
|
@@ -43,4 +43,7 @@ export declare class Channel {
|
|
|
43
43
|
getChannelRecommendations(page: number, options?: IBaseApiParams): Promise<IPageableResponse<IChannel>>;
|
|
44
44
|
managePermissionChannel(id: number, data: IChannelPermissionManageRequest, options?: IBaseApiParams): Promise<IResponse<ChannelPermissionManageResult>>;
|
|
45
45
|
getChannelPermissions(id: number, page: number, options?: IBaseApiParams): Promise<IPageableResponse<IProfileChannel>>;
|
|
46
|
+
editPinnedArticle(id: number, isPinned: boolean, options?: IBaseApiParams): Promise<IResponse<ArticleEditPinnedResult>>;
|
|
47
|
+
articleEvent(eventRequest: IArticleEventRequest, options?: IBaseApiParams): Promise<IResponse>;
|
|
48
|
+
articleMute(id: number, isMuted?: boolean, options?: IBaseApiParams): Promise<IResponse>;
|
|
46
49
|
}
|
package/dist/api/channel.js
CHANGED
|
@@ -119,5 +119,14 @@ class Channel {
|
|
|
119
119
|
async getChannelPermissions(id, page, options) {
|
|
120
120
|
return await this.client.call({ path: `/channel/${id}/permission/all/${page}`, ...options });
|
|
121
121
|
}
|
|
122
|
+
async editPinnedArticle(id, isPinned, options) {
|
|
123
|
+
return await this.client.call({ path: `/article/edit/pinned/${id}`, queryParams: { is_pinned: isPinned }, ...options });
|
|
124
|
+
}
|
|
125
|
+
async articleEvent(eventRequest, options) {
|
|
126
|
+
return await this.client.call({ path: `/article/event`, json: eventRequest, ...options });
|
|
127
|
+
}
|
|
128
|
+
async articleMute(id, isMuted = true, options) {
|
|
129
|
+
return await this.client.call({ path: `/article/${isMuted ? "mute" : "unmute"}/${id}`, ...options });
|
|
130
|
+
}
|
|
122
131
|
}
|
|
123
132
|
exports.Channel = Channel;
|
package/dist/api/profile.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Anixart } from "../client";
|
|
2
|
-
import { IProfileResponse, IBookmarkRequest, IFriendsRequest, IProfileShort, IFriendRequestResponse, IBaseApiParams, IPageableResponse, IRelease, IProfile, IResponse, ISubsciptionCountResponse, IVoteRelease, RemoveFriendRequestResult, AchivementResult, ISocialResponse, IExportBookmarksResponse, BlocklistAddResult, BookmarkType, IChannel } from "../types";
|
|
2
|
+
import { IProfileResponse, IBookmarkRequest, IFriendsRequest, IProfileShort, IFriendRequestResponse, IBaseApiParams, IPageableResponse, IRelease, IProfile, IResponse, ISubsciptionCountResponse, IVoteRelease, RemoveFriendRequestResult, AchivementResult, ISocialResponse, IExportBookmarksResponse, BlocklistAddResult, BookmarkType, IChannel, IHealthStatusResponse, IProfileEnforcementResponse, IEditEnforcement, IExpiringEnforcement, IProfileEnforcement, IArticleComment } from "../types";
|
|
3
3
|
/**
|
|
4
4
|
* Класс профиля
|
|
5
5
|
*
|
|
@@ -385,4 +385,79 @@ export declare class Profile {
|
|
|
385
385
|
* const result = await client.endpoints.profile.removeToBlocklist(1);
|
|
386
386
|
*/
|
|
387
387
|
removeFromBlocklist(id: number, options?: IBaseApiParams): Promise<IResponse<BlocklistAddResult>>;
|
|
388
|
+
/**
|
|
389
|
+
* Получения статуса здоровья профиля
|
|
390
|
+
*
|
|
391
|
+
* Возвращает ответ {@link IHealthStatusResponse}.
|
|
392
|
+
*
|
|
393
|
+
* Возможные ответы API в виде enum смотреть здесь {@link DefaultResult}
|
|
394
|
+
*
|
|
395
|
+
* @param options - Дополнительные параметры
|
|
396
|
+
* @returns Информацию о статусе
|
|
397
|
+
*
|
|
398
|
+
* @example
|
|
399
|
+
* const result = await client.endpoints.profile.getHealthStatus();
|
|
400
|
+
*/
|
|
401
|
+
getHealthStatus(options?: IBaseApiParams): Promise<IHealthStatusResponse>;
|
|
402
|
+
/**
|
|
403
|
+
* Получение действий с контентом
|
|
404
|
+
*
|
|
405
|
+
* Возвращает список {@link IEditEnforcement<any>}, {@link IProfileEnforcement} и {@link IExpiringEnforcement} внутри {@link IPageableResponse}.
|
|
406
|
+
*
|
|
407
|
+
* Возможные ответы API в виде enum смотреть здесь {@link DefaultResult}
|
|
408
|
+
*
|
|
409
|
+
* @param page - Номер страницы
|
|
410
|
+
* @param options - Дополнительные параметры
|
|
411
|
+
* @returns Список действий
|
|
412
|
+
*
|
|
413
|
+
* @example
|
|
414
|
+
* const result = await client.endpoints.profile.getEnforcementContent(0);
|
|
415
|
+
*/
|
|
416
|
+
getEnforcementContent(page: number, options?: IBaseApiParams): Promise<IPageableResponse<IEditEnforcement<any> | IExpiringEnforcement | IProfileEnforcement>>;
|
|
417
|
+
/**
|
|
418
|
+
* Получение ограничений аккаунта
|
|
419
|
+
*
|
|
420
|
+
* Возвращает список {@link IEditEnforcement<any>}, {@link IProfileEnforcement} и {@link IExpiringEnforcement} внутри {@link IPageableResponse}.
|
|
421
|
+
*
|
|
422
|
+
* Возможные ответы API в виде enum смотреть здесь {@link DefaultResult}
|
|
423
|
+
*
|
|
424
|
+
* @param page - Номер страницы
|
|
425
|
+
* @param options - Дополнительные параметры
|
|
426
|
+
* @returns Список ограничений
|
|
427
|
+
*
|
|
428
|
+
* @example
|
|
429
|
+
* const result = await client.endpoints.profile.getEnforcementAccount(0);
|
|
430
|
+
*/
|
|
431
|
+
getEnforcementAccount(page: number, options?: IBaseApiParams): Promise<IPageableResponse<IEditEnforcement<any> | IExpiringEnforcement | IProfileEnforcement>>;
|
|
432
|
+
/**
|
|
433
|
+
* Получение конкретного действия
|
|
434
|
+
*
|
|
435
|
+
* Возвращает ответ {@link IProfileEnforcementResponse}.
|
|
436
|
+
*
|
|
437
|
+
* Возможные ответы API в виде enum смотреть здесь {@link DefaultResult}
|
|
438
|
+
*
|
|
439
|
+
* @param id - ID действия
|
|
440
|
+
* @param options - Дополнительные параметры
|
|
441
|
+
* @returns Действие
|
|
442
|
+
*
|
|
443
|
+
* @example
|
|
444
|
+
* const result = await client.endpoints.profile.getEnforcement(1);
|
|
445
|
+
*/
|
|
446
|
+
getEnforcement(id: number, options?: IBaseApiParams): Promise<IProfileEnforcementResponse>;
|
|
447
|
+
/**
|
|
448
|
+
* Получение комментариев под постами от конкретного профиля
|
|
449
|
+
*
|
|
450
|
+
* Возвращает список {@link IArticleComment} внутри {@link IPageableResponse}.
|
|
451
|
+
*
|
|
452
|
+
* Возможные ответы API в виде enum смотреть здесь {@link DefaultResult}
|
|
453
|
+
*
|
|
454
|
+
* @param id - ID профиля
|
|
455
|
+
* @param page - Номер страницы
|
|
456
|
+
* @param options - Дополнительные параметры
|
|
457
|
+
* @returns Список комментариев
|
|
458
|
+
*
|
|
459
|
+
* @example
|
|
460
|
+
* const result = await client.endpoints.profile.getArticleComments(1, 0);
|
|
461
|
+
*/
|
|
462
|
+
getArticleComments(id: number, page: number, options?: IBaseApiParams): Promise<IPageableResponse<IArticleComment>>;
|
|
388
463
|
}
|
package/dist/api/profile.js
CHANGED
|
@@ -26,7 +26,10 @@ class Profile {
|
|
|
26
26
|
* const result = await client.endpoints.profile.info(1);
|
|
27
27
|
*/
|
|
28
28
|
async info(id, options) {
|
|
29
|
-
return this.client.call({
|
|
29
|
+
return this.client.call({
|
|
30
|
+
path: `/profile/${id}`,
|
|
31
|
+
...options,
|
|
32
|
+
});
|
|
30
33
|
}
|
|
31
34
|
/**
|
|
32
35
|
* Получение закладок из профиля по его ID
|
|
@@ -50,7 +53,15 @@ class Profile {
|
|
|
50
53
|
* });
|
|
51
54
|
*/
|
|
52
55
|
async getBookmarks(data, options) {
|
|
53
|
-
return this.client.call({
|
|
56
|
+
return this.client.call({
|
|
57
|
+
path: `/profile/list/all/${data.id ? `${data.id}/` : ""}${data.type}/${data.page}`,
|
|
58
|
+
queryParams: {
|
|
59
|
+
sort: data.sort,
|
|
60
|
+
filter: data.filter,
|
|
61
|
+
filter_announce: data.filter_announce,
|
|
62
|
+
},
|
|
63
|
+
...options,
|
|
64
|
+
});
|
|
54
65
|
}
|
|
55
66
|
/**
|
|
56
67
|
* Добавление релиза в закладку
|
|
@@ -70,7 +81,10 @@ class Profile {
|
|
|
70
81
|
* const result = await client.endpoints.profile.addBookmarks(1, BookmarkType.Watching);
|
|
71
82
|
*/
|
|
72
83
|
async addBookmark(id, type, options) {
|
|
73
|
-
return this.client.call({
|
|
84
|
+
return this.client.call({
|
|
85
|
+
path: `/profile/list/add/${type}/${id}`,
|
|
86
|
+
...options,
|
|
87
|
+
});
|
|
74
88
|
}
|
|
75
89
|
/**
|
|
76
90
|
* Удаление релиза из закладки
|
|
@@ -90,7 +104,10 @@ class Profile {
|
|
|
90
104
|
* const result = await client.endpoints.profile.removeBookmarks(1, BookmarkType.Watching);
|
|
91
105
|
*/
|
|
92
106
|
async removeBookmark(id, type, options) {
|
|
93
|
-
return this.client.call({
|
|
107
|
+
return this.client.call({
|
|
108
|
+
path: `/profile/list/delete/${type}/${id}`,
|
|
109
|
+
...options,
|
|
110
|
+
});
|
|
94
111
|
}
|
|
95
112
|
/**
|
|
96
113
|
* Получение друзей профиля по его ID
|
|
@@ -144,7 +161,11 @@ class Profile {
|
|
|
144
161
|
* const result = await client.endpoints.profile.getLastFriendRequests("in", 5);
|
|
145
162
|
*/
|
|
146
163
|
async getLastFriendRequests(type, count, options) {
|
|
147
|
-
return await this.client.call({
|
|
164
|
+
return await this.client.call({
|
|
165
|
+
path: `/profile/friend/requests/${type}/last`,
|
|
166
|
+
queryParams: { count },
|
|
167
|
+
...options,
|
|
168
|
+
});
|
|
148
169
|
}
|
|
149
170
|
/**
|
|
150
171
|
* Получение списка заявок в друзья
|
|
@@ -213,7 +234,10 @@ class Profile {
|
|
|
213
234
|
* const result = await client.endpoints.profile.hideFriendRequest(1);
|
|
214
235
|
*/
|
|
215
236
|
async hideFriendRequest(id, options) {
|
|
216
|
-
return await this.client.call({
|
|
237
|
+
return await this.client.call({
|
|
238
|
+
path: `/profile/friend/request/hide/${id}`,
|
|
239
|
+
...options,
|
|
240
|
+
});
|
|
217
241
|
}
|
|
218
242
|
/**
|
|
219
243
|
* Получение достижения в профиль
|
|
@@ -255,7 +279,15 @@ class Profile {
|
|
|
255
279
|
* });
|
|
256
280
|
*/
|
|
257
281
|
async getFavorites(data, options) {
|
|
258
|
-
return await this.client.call({
|
|
282
|
+
return await this.client.call({
|
|
283
|
+
path: `/favorite/all/${data.page}`,
|
|
284
|
+
queryParams: {
|
|
285
|
+
sort: data.sort,
|
|
286
|
+
filter: data.filter,
|
|
287
|
+
filter_announce: data.filter_announce,
|
|
288
|
+
},
|
|
289
|
+
...options,
|
|
290
|
+
});
|
|
259
291
|
}
|
|
260
292
|
/**
|
|
261
293
|
* Получение подписок в профиле на каналы и блоги
|
|
@@ -272,7 +304,10 @@ class Profile {
|
|
|
272
304
|
* const result = await client.endpoints.profile.getSubsciptions(0);
|
|
273
305
|
*/
|
|
274
306
|
async getSubsciptions(page, options) {
|
|
275
|
-
return await this.client.call({
|
|
307
|
+
return await this.client.call({
|
|
308
|
+
path: `/channel/subscription/all/${page}`,
|
|
309
|
+
...options,
|
|
310
|
+
});
|
|
276
311
|
}
|
|
277
312
|
/**
|
|
278
313
|
* Получение количество подписок в профиле на каналы и блоги
|
|
@@ -288,7 +323,10 @@ class Profile {
|
|
|
288
323
|
* const result = await client.endpoints.profile.getSubsciptionCount(0);
|
|
289
324
|
*/
|
|
290
325
|
async getSubscriptionCount(options) {
|
|
291
|
-
return await this.client.call({
|
|
326
|
+
return await this.client.call({
|
|
327
|
+
path: `/channel/subscription/count`,
|
|
328
|
+
...options,
|
|
329
|
+
});
|
|
292
330
|
}
|
|
293
331
|
/**
|
|
294
332
|
* Получение списка оцененных релизов профиля
|
|
@@ -307,7 +345,11 @@ class Profile {
|
|
|
307
345
|
* const result = await client.endpoints.profile.getVotedReleases(1, 0);
|
|
308
346
|
*/
|
|
309
347
|
async getVotedReleases(id, page, sort = 1, options) {
|
|
310
|
-
return await this.client.call({
|
|
348
|
+
return await this.client.call({
|
|
349
|
+
path: `/profile/vote/release/voted/${id}/${page}`,
|
|
350
|
+
queryParams: { sort },
|
|
351
|
+
...options,
|
|
352
|
+
});
|
|
311
353
|
}
|
|
312
354
|
/**
|
|
313
355
|
* Получение списка юзернеймов профиля на другие соц. сети
|
|
@@ -324,7 +366,10 @@ class Profile {
|
|
|
324
366
|
* const result = await client.endpoints.profile.getSocials(1);
|
|
325
367
|
*/
|
|
326
368
|
async getSocials(id, options) {
|
|
327
|
-
return await this.client.call({
|
|
369
|
+
return await this.client.call({
|
|
370
|
+
path: `/profile/social/${id}`,
|
|
371
|
+
...options,
|
|
372
|
+
});
|
|
328
373
|
}
|
|
329
374
|
/**
|
|
330
375
|
* Получение списка неоцененных релизов профиля (Предположительно которые находятся в закладках профиля)
|
|
@@ -341,7 +386,10 @@ class Profile {
|
|
|
341
386
|
* const result = await client.endpoints.profile.getUnvotedReleases(0);
|
|
342
387
|
*/
|
|
343
388
|
async getUnvotedReleases(page = "last", options) {
|
|
344
|
-
return await this.client.call({
|
|
389
|
+
return await this.client.call({
|
|
390
|
+
path: `/profile/vote/release/unvoted/${page}`,
|
|
391
|
+
...options,
|
|
392
|
+
});
|
|
345
393
|
}
|
|
346
394
|
/**
|
|
347
395
|
* Получение списка профилей у которых есть конкретная роль
|
|
@@ -380,7 +428,12 @@ class Profile {
|
|
|
380
428
|
* const result = await client.endpoints.profile.exportBookmarks(bookmarks);
|
|
381
429
|
*/
|
|
382
430
|
async exportBookmarks(listIds, sort, options) {
|
|
383
|
-
return await this.client.call({
|
|
431
|
+
return await this.client.call({
|
|
432
|
+
path: "/export/bookmarks",
|
|
433
|
+
json: { bookmarksExportProfileLists: listIds },
|
|
434
|
+
queryParams: { sort },
|
|
435
|
+
...options,
|
|
436
|
+
});
|
|
384
437
|
}
|
|
385
438
|
/**
|
|
386
439
|
* Получение списка профилей которые находятся в блоклисте
|
|
@@ -397,7 +450,10 @@ class Profile {
|
|
|
397
450
|
* const result = await client.endpoints.profile.getBlocklist(0);
|
|
398
451
|
*/
|
|
399
452
|
async getBlocklist(page, options) {
|
|
400
|
-
return await this.client.call({
|
|
453
|
+
return await this.client.call({
|
|
454
|
+
path: `/profile/blocklist/all/${page}`,
|
|
455
|
+
...options,
|
|
456
|
+
});
|
|
401
457
|
}
|
|
402
458
|
/**
|
|
403
459
|
* Добавление профиля в блоклист
|
|
@@ -414,7 +470,10 @@ class Profile {
|
|
|
414
470
|
* const result = await client.endpoints.profile.addToBlocklist(1);
|
|
415
471
|
*/
|
|
416
472
|
async addToBlocklist(id, options) {
|
|
417
|
-
return await this.client.call({
|
|
473
|
+
return await this.client.call({
|
|
474
|
+
path: `/profile/blocklist/add/${id}`,
|
|
475
|
+
...options,
|
|
476
|
+
});
|
|
418
477
|
}
|
|
419
478
|
/**
|
|
420
479
|
* Удаление профиля из блоклиста
|
|
@@ -433,5 +492,99 @@ class Profile {
|
|
|
433
492
|
async removeFromBlocklist(id, options) {
|
|
434
493
|
return await this.client.call({ path: `/profile/blocklist/remove/${id}`, ...options });
|
|
435
494
|
}
|
|
495
|
+
/**
|
|
496
|
+
* Получения статуса здоровья профиля
|
|
497
|
+
*
|
|
498
|
+
* Возвращает ответ {@link IHealthStatusResponse}.
|
|
499
|
+
*
|
|
500
|
+
* Возможные ответы API в виде enum смотреть здесь {@link DefaultResult}
|
|
501
|
+
*
|
|
502
|
+
* @param options - Дополнительные параметры
|
|
503
|
+
* @returns Информацию о статусе
|
|
504
|
+
*
|
|
505
|
+
* @example
|
|
506
|
+
* const result = await client.endpoints.profile.getHealthStatus();
|
|
507
|
+
*/
|
|
508
|
+
async getHealthStatus(options) {
|
|
509
|
+
return await this.client.call({
|
|
510
|
+
path: "/profile/health/status",
|
|
511
|
+
...options,
|
|
512
|
+
});
|
|
513
|
+
}
|
|
514
|
+
/**
|
|
515
|
+
* Получение действий с контентом
|
|
516
|
+
*
|
|
517
|
+
* Возвращает список {@link IEditEnforcement<any>}, {@link IProfileEnforcement} и {@link IExpiringEnforcement} внутри {@link IPageableResponse}.
|
|
518
|
+
*
|
|
519
|
+
* Возможные ответы API в виде enum смотреть здесь {@link DefaultResult}
|
|
520
|
+
*
|
|
521
|
+
* @param page - Номер страницы
|
|
522
|
+
* @param options - Дополнительные параметры
|
|
523
|
+
* @returns Список действий
|
|
524
|
+
*
|
|
525
|
+
* @example
|
|
526
|
+
* const result = await client.endpoints.profile.getEnforcementContent(0);
|
|
527
|
+
*/
|
|
528
|
+
async getEnforcementContent(page, options) {
|
|
529
|
+
return await this.client.call({ path: `/profile/health/enforcement/content/all/${page}`, ...options });
|
|
530
|
+
}
|
|
531
|
+
/**
|
|
532
|
+
* Получение ограничений аккаунта
|
|
533
|
+
*
|
|
534
|
+
* Возвращает список {@link IEditEnforcement<any>}, {@link IProfileEnforcement} и {@link IExpiringEnforcement} внутри {@link IPageableResponse}.
|
|
535
|
+
*
|
|
536
|
+
* Возможные ответы API в виде enum смотреть здесь {@link DefaultResult}
|
|
537
|
+
*
|
|
538
|
+
* @param page - Номер страницы
|
|
539
|
+
* @param options - Дополнительные параметры
|
|
540
|
+
* @returns Список ограничений
|
|
541
|
+
*
|
|
542
|
+
* @example
|
|
543
|
+
* const result = await client.endpoints.profile.getEnforcementAccount(0);
|
|
544
|
+
*/
|
|
545
|
+
async getEnforcementAccount(page, options) {
|
|
546
|
+
return await this.client.call({ path: `/profile/health/enforcement/account/all/${page}`, ...options });
|
|
547
|
+
}
|
|
548
|
+
/**
|
|
549
|
+
* Получение конкретного действия
|
|
550
|
+
*
|
|
551
|
+
* Возвращает ответ {@link IProfileEnforcementResponse}.
|
|
552
|
+
*
|
|
553
|
+
* Возможные ответы API в виде enum смотреть здесь {@link DefaultResult}
|
|
554
|
+
*
|
|
555
|
+
* @param id - ID действия
|
|
556
|
+
* @param options - Дополнительные параметры
|
|
557
|
+
* @returns Действие
|
|
558
|
+
*
|
|
559
|
+
* @example
|
|
560
|
+
* const result = await client.endpoints.profile.getEnforcement(1);
|
|
561
|
+
*/
|
|
562
|
+
async getEnforcement(id, options) {
|
|
563
|
+
return await this.client.call({
|
|
564
|
+
path: `/profile/health/enforcement/${id}`,
|
|
565
|
+
...options,
|
|
566
|
+
});
|
|
567
|
+
}
|
|
568
|
+
/**
|
|
569
|
+
* Получение комментариев под постами от конкретного профиля
|
|
570
|
+
*
|
|
571
|
+
* Возвращает список {@link IArticleComment} внутри {@link IPageableResponse}.
|
|
572
|
+
*
|
|
573
|
+
* Возможные ответы API в виде enum смотреть здесь {@link DefaultResult}
|
|
574
|
+
*
|
|
575
|
+
* @param id - ID профиля
|
|
576
|
+
* @param page - Номер страницы
|
|
577
|
+
* @param options - Дополнительные параметры
|
|
578
|
+
* @returns Список комментариев
|
|
579
|
+
*
|
|
580
|
+
* @example
|
|
581
|
+
* const result = await client.endpoints.profile.getArticleComments(1, 0);
|
|
582
|
+
*/
|
|
583
|
+
async getArticleComments(id, page, options) {
|
|
584
|
+
return await this.client.call({
|
|
585
|
+
path: `/article/comment/all/profile/${id}/${page}`,
|
|
586
|
+
...options,
|
|
587
|
+
});
|
|
588
|
+
}
|
|
436
589
|
}
|
|
437
590
|
exports.Profile = Profile;
|
|
@@ -17,7 +17,7 @@ export declare class BaseProfile {
|
|
|
17
17
|
readonly isSponsor: boolean;
|
|
18
18
|
readonly isVerified: boolean;
|
|
19
19
|
readonly isOnline: boolean;
|
|
20
|
-
readonly friendStatus: number;
|
|
20
|
+
readonly friendStatus: number | null;
|
|
21
21
|
readonly friendCount: number;
|
|
22
22
|
constructor(client: Anixart, profile: IProfileShort);
|
|
23
23
|
getFriends(page?: number): Promise<BaseProfile[]>;
|
|
@@ -15,7 +15,6 @@ export declare class FullProfile extends BaseProfile {
|
|
|
15
15
|
readonly instPage: string;
|
|
16
16
|
readonly ttPage: string;
|
|
17
17
|
readonly discordPage: string;
|
|
18
|
-
readonly banNote: unknown;
|
|
19
18
|
readonly watchingCount: number;
|
|
20
19
|
readonly planCount: number;
|
|
21
20
|
readonly completedCount: number;
|
|
@@ -36,7 +36,6 @@ class FullProfile extends BaseProfile_1.BaseProfile {
|
|
|
36
36
|
this.instPage = profile.inst_page;
|
|
37
37
|
this.ttPage = profile.tt_page;
|
|
38
38
|
this.discordPage = profile.discord_page;
|
|
39
|
-
this.banNote = profile.ban_note;
|
|
40
39
|
this.watchingCount = profile.watching_count;
|
|
41
40
|
this.planCount = profile.plan_count;
|
|
42
41
|
this.completedCount = profile.completed_count;
|
package/dist/types/channel.d.ts
CHANGED
|
@@ -195,6 +195,11 @@ export interface IChannelPermissionManageRequest {
|
|
|
195
195
|
target_profile_id: number;
|
|
196
196
|
permission: number;
|
|
197
197
|
}
|
|
198
|
+
export interface IArticleEventRequest {
|
|
199
|
+
type: "view" | "open" | "read";
|
|
200
|
+
entry_point: "article" | "feed" | "channel" | "latest" | "search" | "unknown";
|
|
201
|
+
articles: number[];
|
|
202
|
+
}
|
|
198
203
|
export declare enum ArticleCreateEditResult {
|
|
199
204
|
InvalidRepostArticle = 2,
|
|
200
205
|
InvalidPayload = 3,
|
|
@@ -275,3 +280,9 @@ export declare enum ArticleSuggestionDeleteResult {
|
|
|
275
280
|
ArticleSuggestionNotFound = 2,
|
|
276
281
|
ArticleSuggestionNotOwned = 3
|
|
277
282
|
}
|
|
283
|
+
export declare enum ArticleEditPinnedResult {
|
|
284
|
+
ArticleDeleted = 2,
|
|
285
|
+
ArticleNotFound = 3,
|
|
286
|
+
ChannelNotFound = 4,
|
|
287
|
+
ChannelNotOwned = 5
|
|
288
|
+
}
|
package/dist/types/channel.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ArticleSuggestionDeleteResult = exports.ArticleSuggestionPublishResult = exports.EditorAvaliableResult = exports.ChannelUploadCoverAvatarResult = exports.ChannelBlockResult = exports.ChannelUnsubscribeResult = exports.ChannelSubscribeResult = exports.ChannelResult = exports.ChannelPermissionManageResult = exports.ChannelCreateEditResult = exports.BlogCreateResult = exports.ArticleResult = exports.ArticleDeleteResult = exports.ArticleCreateEditResult = void 0;
|
|
3
|
+
exports.ArticleEditPinnedResult = exports.ArticleSuggestionDeleteResult = exports.ArticleSuggestionPublishResult = exports.EditorAvaliableResult = exports.ChannelUploadCoverAvatarResult = exports.ChannelBlockResult = exports.ChannelUnsubscribeResult = exports.ChannelSubscribeResult = exports.ChannelResult = exports.ChannelPermissionManageResult = exports.ChannelCreateEditResult = exports.BlogCreateResult = exports.ArticleResult = exports.ArticleDeleteResult = exports.ArticleCreateEditResult = void 0;
|
|
4
4
|
var ArticleCreateEditResult;
|
|
5
5
|
(function (ArticleCreateEditResult) {
|
|
6
6
|
ArticleCreateEditResult[ArticleCreateEditResult["InvalidRepostArticle"] = 2] = "InvalidRepostArticle";
|
|
@@ -95,3 +95,10 @@ var ArticleSuggestionDeleteResult;
|
|
|
95
95
|
ArticleSuggestionDeleteResult[ArticleSuggestionDeleteResult["ArticleSuggestionNotFound"] = 2] = "ArticleSuggestionNotFound";
|
|
96
96
|
ArticleSuggestionDeleteResult[ArticleSuggestionDeleteResult["ArticleSuggestionNotOwned"] = 3] = "ArticleSuggestionNotOwned";
|
|
97
97
|
})(ArticleSuggestionDeleteResult || (exports.ArticleSuggestionDeleteResult = ArticleSuggestionDeleteResult = {}));
|
|
98
|
+
var ArticleEditPinnedResult;
|
|
99
|
+
(function (ArticleEditPinnedResult) {
|
|
100
|
+
ArticleEditPinnedResult[ArticleEditPinnedResult["ArticleDeleted"] = 2] = "ArticleDeleted";
|
|
101
|
+
ArticleEditPinnedResult[ArticleEditPinnedResult["ArticleNotFound"] = 3] = "ArticleNotFound";
|
|
102
|
+
ArticleEditPinnedResult[ArticleEditPinnedResult["ChannelNotFound"] = 4] = "ChannelNotFound";
|
|
103
|
+
ArticleEditPinnedResult[ArticleEditPinnedResult["ChannelNotOwned"] = 5] = "ChannelNotOwned";
|
|
104
|
+
})(ArticleEditPinnedResult || (exports.ArticleEditPinnedResult = ArticleEditPinnedResult = {}));
|
package/dist/types/profile.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { IResponse } from "./response";
|
|
1
|
+
import { IBaseComment, IResponse } from "./response";
|
|
2
2
|
import { IBaseRequestPageable } from "./request";
|
|
3
|
-
import { IRelease, IVoteRelease } from "./release";
|
|
3
|
+
import { IRelease, IVideo, IVoteRelease } from "./release";
|
|
4
|
+
import { ICollection } from "./collection";
|
|
4
5
|
export declare enum BookmarkType {
|
|
5
6
|
Watching = 1,
|
|
6
7
|
InPlans = 2,
|
|
@@ -27,6 +28,9 @@ export interface IProfileToken {
|
|
|
27
28
|
id: string;
|
|
28
29
|
token: string;
|
|
29
30
|
}
|
|
31
|
+
export interface ICommentPreview extends IBaseComment {
|
|
32
|
+
commentType: string;
|
|
33
|
+
}
|
|
30
34
|
export interface IProfile {
|
|
31
35
|
id: number;
|
|
32
36
|
login: string;
|
|
@@ -35,6 +39,10 @@ export interface IProfile {
|
|
|
35
39
|
sponsorshipExpires: number;
|
|
36
40
|
history: IRelease[];
|
|
37
41
|
votes: IVoteRelease[];
|
|
42
|
+
friends_preview: IProfileShort[];
|
|
43
|
+
collections_preview: ICollection[];
|
|
44
|
+
comments_preview: ICommentPreview[];
|
|
45
|
+
release_video_preview: IVideo[];
|
|
38
46
|
last_activity_time: number;
|
|
39
47
|
register_date: number;
|
|
40
48
|
vk_page: string;
|
|
@@ -44,7 +52,6 @@ export interface IProfile {
|
|
|
44
52
|
discord_page: string;
|
|
45
53
|
ban_expires: number;
|
|
46
54
|
ban_reason: string;
|
|
47
|
-
ban_note: string | null;
|
|
48
55
|
privilege_level: number;
|
|
49
56
|
watching_count: number;
|
|
50
57
|
plan_count: number;
|
|
@@ -56,16 +63,22 @@ export interface IProfile {
|
|
|
56
63
|
collection_count: number;
|
|
57
64
|
video_count: number;
|
|
58
65
|
friend_count: number;
|
|
66
|
+
subscription_count: number;
|
|
59
67
|
watched_episode_count: number;
|
|
60
68
|
watched_time: number;
|
|
69
|
+
pinned_section_id: number;
|
|
61
70
|
is_private: boolean;
|
|
62
71
|
is_sponsor: boolean;
|
|
63
72
|
is_banned: boolean;
|
|
73
|
+
is_incognito: boolean;
|
|
74
|
+
is_deleted: boolean;
|
|
75
|
+
is_deletion_requested: boolean;
|
|
64
76
|
is_perm_banned: boolean;
|
|
65
77
|
is_bookmarks_transferred: boolean;
|
|
66
78
|
is_sponsor_transferred: boolean;
|
|
67
79
|
is_vk_bound: boolean;
|
|
68
80
|
is_google_bound: boolean;
|
|
81
|
+
is_article_notifications_enabled: boolean;
|
|
69
82
|
is_release_type_notifications_enabled: boolean;
|
|
70
83
|
is_episode_notifications_enabled: boolean;
|
|
71
84
|
is_first_episode_notification_enabled: boolean;
|
|
@@ -73,9 +86,12 @@ export interface IProfile {
|
|
|
73
86
|
is_report_process_notifications_enabled: boolean;
|
|
74
87
|
is_comment_notifications_enabled: boolean;
|
|
75
88
|
is_my_collection_comment_notifications_enabled: boolean;
|
|
89
|
+
is_my_article_comment_notifications_enabled: boolean;
|
|
76
90
|
is_verified: boolean;
|
|
91
|
+
deletion_requested_at: number;
|
|
92
|
+
deletion_delete_at: number;
|
|
77
93
|
watch_dynamics: IWatchDynamics[];
|
|
78
|
-
friend_status: number;
|
|
94
|
+
friend_status: number | null;
|
|
79
95
|
rating_score: number;
|
|
80
96
|
is_blocked: boolean;
|
|
81
97
|
is_me_blocked: boolean;
|
|
@@ -139,7 +155,7 @@ export interface IProfileShort {
|
|
|
139
155
|
is_sponsor: boolean;
|
|
140
156
|
is_verified: boolean;
|
|
141
157
|
is_online: boolean;
|
|
142
|
-
friend_status: number;
|
|
158
|
+
friend_status: number | null;
|
|
143
159
|
friend_count: number;
|
|
144
160
|
}
|
|
145
161
|
export interface IProfileChannel {
|
|
@@ -190,6 +206,43 @@ export interface ISocialResponse extends IResponse {
|
|
|
190
206
|
tt_page: string;
|
|
191
207
|
discord_page: string;
|
|
192
208
|
}
|
|
209
|
+
export interface IHealthStatusResponse extends IResponse {
|
|
210
|
+
ban_count: number;
|
|
211
|
+
ban_for_3_month_count: number;
|
|
212
|
+
last_ban_timestamp: number;
|
|
213
|
+
last_ban_expires: number;
|
|
214
|
+
blog_suspension_expires: number;
|
|
215
|
+
blog_mute_expires: number;
|
|
216
|
+
}
|
|
217
|
+
export interface IProfileEnforcement {
|
|
218
|
+
type: "profile_ban" | "channel_suspension" | "channel_mute" | "article_edit" | "release_comment_edit" | "collection_comment_edit" | "article_comment_edit";
|
|
219
|
+
id: number;
|
|
220
|
+
reason: string | null;
|
|
221
|
+
creation_timestamp: number;
|
|
222
|
+
appeal_type: "UNKNOWN" | "NOT_AVAILABLE" | "MESSAGE" | "ADJUSTMENT";
|
|
223
|
+
appeal_status: "UNKNOWN" | "NOT_SUBMITTED" | "SUBMITTED" | "ACCEPTED" | "REJECTED";
|
|
224
|
+
appeal_submit_timestamp: number | null;
|
|
225
|
+
appeal_expires_timestamp: number | null;
|
|
226
|
+
appeal_process_message: string | null;
|
|
227
|
+
appeal_process_timestamp: number | null;
|
|
228
|
+
revocation_timestamp: number | null;
|
|
229
|
+
is_revoked: boolean;
|
|
230
|
+
}
|
|
231
|
+
export interface IEditEnforcement<T> extends IProfileEnforcement {
|
|
232
|
+
entity_id: number;
|
|
233
|
+
entity: T | null;
|
|
234
|
+
changes: IEditEnforcementChange[];
|
|
235
|
+
}
|
|
236
|
+
export interface IEditEnforcementChange {
|
|
237
|
+
type: string;
|
|
238
|
+
new_value: any;
|
|
239
|
+
}
|
|
240
|
+
export interface IExpiringEnforcement extends IProfileEnforcement {
|
|
241
|
+
expiration_timestamp: number;
|
|
242
|
+
}
|
|
243
|
+
export interface IProfileEnforcementResponse extends IResponse {
|
|
244
|
+
enforcement: IEditEnforcement<any> | IExpiringEnforcement | IProfileEnforcement | null;
|
|
245
|
+
}
|
|
193
246
|
export declare enum SendFriendRequestResult {
|
|
194
247
|
RequestConfirmed = 2,
|
|
195
248
|
RequestSent = 3,
|
|
@@ -214,3 +214,40 @@ export declare class SibnetParser {
|
|
|
214
214
|
static srcMatch: RegExp;
|
|
215
215
|
static getDirectLink(link: string): Promise<string | null>;
|
|
216
216
|
}
|
|
217
|
+
/**
|
|
218
|
+
* RutubeParser
|
|
219
|
+
* Парсер источника Rutube
|
|
220
|
+
*/
|
|
221
|
+
export declare class RutubeParser {
|
|
222
|
+
private static _baseRutubeDomain;
|
|
223
|
+
private static _regExpUrl;
|
|
224
|
+
private static _regExpDirectLink;
|
|
225
|
+
static getDirectLinks(link: string): Promise<Record<string, string> | null>;
|
|
226
|
+
}
|
|
227
|
+
export interface VKVideoTokenResponse {
|
|
228
|
+
token: string;
|
|
229
|
+
expires_at: number;
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* VKVideoParser
|
|
233
|
+
* Парсер источника VKVideo
|
|
234
|
+
*/
|
|
235
|
+
export declare class VKVideoParser {
|
|
236
|
+
private static _baseVkDomain;
|
|
237
|
+
private static _iosUserAgent;
|
|
238
|
+
private static oidRegExp;
|
|
239
|
+
private static idRegExp;
|
|
240
|
+
private static hashRegExp;
|
|
241
|
+
private static _regExpDirectLink;
|
|
242
|
+
static getDirectLinks(link: string): Promise<Record<string, string> | null>;
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* OKParser
|
|
246
|
+
* Парсер источника OK
|
|
247
|
+
*/
|
|
248
|
+
export declare class OKParser {
|
|
249
|
+
private static _regExpDataOptions;
|
|
250
|
+
private static _regExpDirectLink;
|
|
251
|
+
private static _okUserAgent;
|
|
252
|
+
static getDirectLinks(link: string): Promise<Record<string, string> | null>;
|
|
253
|
+
}
|
package/dist/utils/LinkParser.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Парсер различных источников
|
|
4
4
|
*/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.SibnetParser = exports.AniLibriaParser = exports.KodikParser = void 0;
|
|
6
|
+
exports.OKParser = exports.VKVideoParser = exports.RutubeParser = exports.SibnetParser = exports.AniLibriaParser = exports.KodikParser = void 0;
|
|
7
7
|
class KodikParser {
|
|
8
8
|
static async getLatestLink(url) {
|
|
9
9
|
var _a, _b, _c, _d;
|
|
@@ -26,7 +26,7 @@ class KodikParser {
|
|
|
26
26
|
const videoInfoHash = (_e = (_d = urlResponse.match(/\w+.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(/\w+.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(/\w+.type\s=\s'(?<type>.*?)';/)) === null || _h === void 0 ? void 0 : _h.groups) === null || _j === void 0 ? void 0 : _j.type;
|
|
29
|
-
const validKodikUrl =
|
|
29
|
+
const validKodikUrl = /\/\/(get|cloud)\.(kodik-storage|solodcdn)\.com\/useruploads\/.*?\/.*?\/(240|360|480|720|1080)\.mp4:hls:manifest.m3u8/s;
|
|
30
30
|
if (!videoInfoHash || !videoInfoId || !videoInfoType)
|
|
31
31
|
return null;
|
|
32
32
|
const requestBody = {
|
|
@@ -92,8 +92,8 @@ class AniLibriaParser {
|
|
|
92
92
|
exports.AniLibriaParser = AniLibriaParser;
|
|
93
93
|
AniLibriaParser._baseAniLibriaDomain = 'aniliberty.top';
|
|
94
94
|
AniLibriaParser._endpointUrl = '/api/v1/anime/releases';
|
|
95
|
-
AniLibriaParser.idPattern =
|
|
96
|
-
AniLibriaParser.episodePattern =
|
|
95
|
+
AniLibriaParser.idPattern = /id=(?<id>\d+)/;
|
|
96
|
+
AniLibriaParser.episodePattern = /ep=(?<ep>\d+)/;
|
|
97
97
|
/**
|
|
98
98
|
* SibnetParser
|
|
99
99
|
* Парсер источника Sibnet
|
|
@@ -118,4 +118,136 @@ class SibnetParser {
|
|
|
118
118
|
}
|
|
119
119
|
exports.SibnetParser = SibnetParser;
|
|
120
120
|
SibnetParser._baseSibnetDomain = 'video.sibnet.ru';
|
|
121
|
-
SibnetParser.srcMatch = new RegExp(/src: (".*?")/
|
|
121
|
+
SibnetParser.srcMatch = new RegExp(/src: (".*?")/);
|
|
122
|
+
/**
|
|
123
|
+
* RutubeParser
|
|
124
|
+
* Парсер источника Rutube
|
|
125
|
+
*/
|
|
126
|
+
class RutubeParser {
|
|
127
|
+
static async getDirectLinks(link) {
|
|
128
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
129
|
+
const match = (_c = (_b = (_a = this._regExpUrl.exec(link)) === null || _a === void 0 ? void 0 : _a.groups) === null || _b === void 0 ? void 0 : _b.videoId) !== null && _c !== void 0 ? _c : null;
|
|
130
|
+
if (!match)
|
|
131
|
+
return null;
|
|
132
|
+
const request = await fetch(`https://${this._baseRutubeDomain}/api/play/options/${match}/?no_404=true&referer&pver=v2`);
|
|
133
|
+
const body = await request.json();
|
|
134
|
+
const balancerUrl = (_d = body['video_balancer'].default) !== null && _d !== void 0 ? _d : null;
|
|
135
|
+
if (!balancerUrl)
|
|
136
|
+
return null;
|
|
137
|
+
const balancerRequest = await fetch(balancerUrl);
|
|
138
|
+
const balancerBody = await balancerRequest.text();
|
|
139
|
+
let directLinkMatch = this._regExpDirectLink.exec(balancerBody);
|
|
140
|
+
if ((directLinkMatch === null || directLinkMatch === void 0 ? void 0 : directLinkMatch.length) == 0)
|
|
141
|
+
return null;
|
|
142
|
+
let directLinks = {};
|
|
143
|
+
do {
|
|
144
|
+
const width = (_f = (_e = directLinkMatch === null || directLinkMatch === void 0 ? void 0 : directLinkMatch.groups) === null || _e === void 0 ? void 0 : _e.width) !== null && _f !== void 0 ? _f : null;
|
|
145
|
+
const heigth = (_h = (_g = directLinkMatch === null || directLinkMatch === void 0 ? void 0 : directLinkMatch.groups) === null || _g === void 0 ? void 0 : _g.heigth) !== null && _h !== void 0 ? _h : null;
|
|
146
|
+
const url = (_k = (_j = directLinkMatch === null || directLinkMatch === void 0 ? void 0 : directLinkMatch.groups) === null || _j === void 0 ? void 0 : _j.url) !== null && _k !== void 0 ? _k : null;
|
|
147
|
+
if (!width || !heigth || !url)
|
|
148
|
+
break;
|
|
149
|
+
directLinks[`${heigth}`] = url;
|
|
150
|
+
directLinkMatch = this._regExpDirectLink.exec(balancerBody);
|
|
151
|
+
} while (directLinkMatch);
|
|
152
|
+
return directLinks;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
exports.RutubeParser = RutubeParser;
|
|
156
|
+
RutubeParser._baseRutubeDomain = 'rutube.ru';
|
|
157
|
+
RutubeParser._regExpUrl = /(http|https):\/\/(?<domain>\w+.\w+)\/play\/embed\/(?<videoId>\w+)/;
|
|
158
|
+
RutubeParser._regExpDirectLink = /^.*\s*RESOLUTION=(?<width>\d+)x(?<heigth>\d+)\n(?<url>.*)$/gm;
|
|
159
|
+
/**
|
|
160
|
+
* VKVideoParser
|
|
161
|
+
* Парсер источника VKVideo
|
|
162
|
+
*/
|
|
163
|
+
class VKVideoParser {
|
|
164
|
+
static async getDirectLinks(link) {
|
|
165
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
166
|
+
const oid = (_c = (_b = (_a = this.oidRegExp.exec(link)) === null || _a === void 0 ? void 0 : _a.groups) === null || _b === void 0 ? void 0 : _b.oid) !== null && _c !== void 0 ? _c : null;
|
|
167
|
+
const id = (_f = (_e = (_d = this.idRegExp.exec(link)) === null || _d === void 0 ? void 0 : _d.groups) === null || _e === void 0 ? void 0 : _e.id) !== null && _f !== void 0 ? _f : null;
|
|
168
|
+
const hash = (_j = (_h = (_g = this.hashRegExp.exec(link)) === null || _g === void 0 ? void 0 : _g.groups) === null || _h === void 0 ? void 0 : _h.hash) !== null && _j !== void 0 ? _j : null;
|
|
169
|
+
if (!oid || !id || !hash)
|
|
170
|
+
return null;
|
|
171
|
+
const uuid = crypto.randomUUID();
|
|
172
|
+
const tokenResponse = await fetch(`https://oauth.${this._baseVkDomain}/oauth/get_anonym_token?client_id=51552953&client_secret=qgr0yWwXCrsxA1jnRtRX&device_id=${uuid}`, {
|
|
173
|
+
headers: {
|
|
174
|
+
'User-Agent': this._iosUserAgent,
|
|
175
|
+
'Host': `oauth.${this._baseVkDomain}`,
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
const anonymToken = await tokenResponse.json();
|
|
179
|
+
const getLinksResponse = await fetch(`https://api.${this._baseVkDomain}/method/video.get`, {
|
|
180
|
+
headers: {
|
|
181
|
+
'User-Agent': this._iosUserAgent,
|
|
182
|
+
'Host': `api.${this._baseVkDomain}`,
|
|
183
|
+
},
|
|
184
|
+
method: 'POST',
|
|
185
|
+
body: `anonymous_token=${anonymToken.token}&device_id=${uuid}&lang=en&v=5.244&videos=${oid}_${id}_${hash}`,
|
|
186
|
+
});
|
|
187
|
+
const getLinksResponseJson = await getLinksResponse.json();
|
|
188
|
+
const hlsMasterRequest = await fetch(getLinksResponseJson.response.items[0].files.hls);
|
|
189
|
+
const vkServerUrl = new URL(hlsMasterRequest.url).host;
|
|
190
|
+
const hlsMasterBody = await hlsMasterRequest.text();
|
|
191
|
+
let directLinkMatch = this._regExpDirectLink.exec(hlsMasterBody);
|
|
192
|
+
if ((directLinkMatch === null || directLinkMatch === void 0 ? void 0 : directLinkMatch.length) == 0)
|
|
193
|
+
return null;
|
|
194
|
+
let directLinks = {};
|
|
195
|
+
do {
|
|
196
|
+
const width = (_l = (_k = directLinkMatch === null || directLinkMatch === void 0 ? void 0 : directLinkMatch.groups) === null || _k === void 0 ? void 0 : _k.width) !== null && _l !== void 0 ? _l : null;
|
|
197
|
+
const heigth = (_o = (_m = directLinkMatch === null || directLinkMatch === void 0 ? void 0 : directLinkMatch.groups) === null || _m === void 0 ? void 0 : _m.heigth) !== null && _o !== void 0 ? _o : null;
|
|
198
|
+
const url = (_q = (_p = directLinkMatch === null || directLinkMatch === void 0 ? void 0 : directLinkMatch.groups) === null || _p === void 0 ? void 0 : _p.url) !== null && _q !== void 0 ? _q : null;
|
|
199
|
+
if (!width || !heigth || !url)
|
|
200
|
+
break;
|
|
201
|
+
directLinks[`${heigth}`] = `https://${vkServerUrl}${url}`;
|
|
202
|
+
directLinkMatch = this._regExpDirectLink.exec(hlsMasterBody);
|
|
203
|
+
} while (directLinkMatch);
|
|
204
|
+
return directLinks;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
exports.VKVideoParser = VKVideoParser;
|
|
208
|
+
VKVideoParser._baseVkDomain = 'vk.com';
|
|
209
|
+
VKVideoParser._iosUserAgent = "com.vk.vkvideo.prod/822 (iPhone, iOS 16.7.7, iPhone10,4, Scale/2.0) SAK/1.119";
|
|
210
|
+
VKVideoParser.oidRegExp = /[?&]oid=(?<oid>(-|)\d+)/;
|
|
211
|
+
VKVideoParser.idRegExp = /[?&]id=(?<id>(-|)\d+)/;
|
|
212
|
+
VKVideoParser.hashRegExp = /[?&]hash=(?<hash>\w+)/;
|
|
213
|
+
VKVideoParser._regExpDirectLink = /^.*\s*RESOLUTION=(?<width>\d+)x(?<heigth>\d+)\n(?<url>.*)$/gm;
|
|
214
|
+
/**
|
|
215
|
+
* OKParser
|
|
216
|
+
* Парсер источника OK
|
|
217
|
+
*/
|
|
218
|
+
class OKParser {
|
|
219
|
+
static async getDirectLinks(link) {
|
|
220
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
221
|
+
const request = await fetch(link, { headers: { 'User-Agent': this._okUserAgent } });
|
|
222
|
+
const body = await request.text();
|
|
223
|
+
const dataOptionsMatch = (_c = (_b = (_a = this._regExpDataOptions.exec(body)) === null || _a === void 0 ? void 0 : _a.groups) === null || _b === void 0 ? void 0 : _b.content) !== null && _c !== void 0 ? _c : null;
|
|
224
|
+
if (!dataOptionsMatch)
|
|
225
|
+
return null;
|
|
226
|
+
const dataOptions = dataOptionsMatch.replace(/"/g, "\"").replace(/\\\\u0026/g, "&");
|
|
227
|
+
const dataOptionsJson = JSON.parse(dataOptions);
|
|
228
|
+
const metadataJson = JSON.parse(dataOptionsJson.flashvars.metadata);
|
|
229
|
+
if (metadataJson.provider != "UPLOADED_ODKL" || metadataJson.isLive)
|
|
230
|
+
return null;
|
|
231
|
+
const hlsMasterRequest = await fetch(metadataJson.hlsManifestUrl, { headers: { 'User-Agent': this._okUserAgent } });
|
|
232
|
+
const hlsMasterBody = await hlsMasterRequest.text();
|
|
233
|
+
const okServerUrl = new URL(hlsMasterRequest.url).host;
|
|
234
|
+
let directLinkMatch = this._regExpDirectLink.exec(hlsMasterBody);
|
|
235
|
+
if ((directLinkMatch === null || directLinkMatch === void 0 ? void 0 : directLinkMatch.length) == 0)
|
|
236
|
+
return null;
|
|
237
|
+
let directLinks = {};
|
|
238
|
+
do {
|
|
239
|
+
const width = (_e = (_d = directLinkMatch === null || directLinkMatch === void 0 ? void 0 : directLinkMatch.groups) === null || _d === void 0 ? void 0 : _d.width) !== null && _e !== void 0 ? _e : null;
|
|
240
|
+
const heigth = (_g = (_f = directLinkMatch === null || directLinkMatch === void 0 ? void 0 : directLinkMatch.groups) === null || _f === void 0 ? void 0 : _f.heigth) !== null && _g !== void 0 ? _g : null;
|
|
241
|
+
const url = (_j = (_h = directLinkMatch === null || directLinkMatch === void 0 ? void 0 : directLinkMatch.groups) === null || _h === void 0 ? void 0 : _h.url) !== null && _j !== void 0 ? _j : null;
|
|
242
|
+
if (!width || !heigth || !url)
|
|
243
|
+
break;
|
|
244
|
+
directLinks[`${heigth}`] = `https://${okServerUrl}${url}`;
|
|
245
|
+
directLinkMatch = this._regExpDirectLink.exec(hlsMasterBody);
|
|
246
|
+
} while (directLinkMatch);
|
|
247
|
+
return directLinks;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
exports.OKParser = OKParser;
|
|
251
|
+
OKParser._regExpDataOptions = /data-options="(?<content>{.*})"/m;
|
|
252
|
+
OKParser._regExpDirectLink = /^.*\s*RESOLUTION=(?<width>\d+)x(?<heigth>\d+)\n(?<url>.*)$/gm;
|
|
253
|
+
OKParser._okUserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Safari/537.36";
|