itube-specs 0.0.472 → 0.0.473

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "itube-specs",
3
3
  "type": "module",
4
- "version": "0.0.472",
4
+ "version": "0.0.473",
5
5
  "main": "./nuxt.config.ts",
6
6
  "types": "./types/index.d.ts",
7
7
  "scripts": {
package/runtime/index.ts CHANGED
@@ -6,6 +6,7 @@ export * from './enums/languages';
6
6
  export * from './enums/niche';
7
7
  export * from './enums/report-forms-subjects';
8
8
  export * from './enums/playlist-step';
9
+ export * from './enums/thumb-size';
9
10
  export * from './utils/format-date';
10
11
  export * from './utils/format-number';
11
12
  export * from './utils/get-multiple-query';
@@ -1,9 +1,10 @@
1
1
  import type { IRawCategoryCard, ICategoryCard } from '../../../types';
2
+ import { ThumbSize } from '../../enums/thumb-size';
2
3
 
3
4
  export const cleanCategoryCard = (card: IRawCategoryCard): ICategoryCard => ({
4
5
  name: card.name || '',
5
6
  title: card.title || '',
6
7
  videosCount: card.videosCount || 0,
7
- thumbUrl: card.video_thumb_urls?.webp?.['480x270'] || '',
8
+ thumbUrl: card.video_thumb_urls?.webp?.[ThumbSize.Big] || '',
8
9
  guid: card.guid || '',
9
10
  })
@@ -1,4 +1,5 @@
1
1
  import type { IRawCategoryInfo, ICardInfo } from '../../../types';
2
+ import { ThumbSize } from '../../enums/thumb-size';
2
3
  import { convertCategoriesToChips } from '../converters/convert-categories-to-chips';
3
4
 
4
5
  export const cleanCategoryInfo = (card: IRawCategoryInfo): ICardInfo => ({
@@ -6,7 +7,7 @@ export const cleanCategoryInfo = (card: IRawCategoryInfo): ICardInfo => ({
6
7
  title: card.title || '',
7
8
  videosCount: card.videosCount || 0,
8
9
  description: card.description || '',
9
- thumbUrl: card.video_thumb_urls?.webp?.['480x270'] || '',
10
+ thumbUrl: card.video_thumb_urls?.webp?.[ThumbSize.Big] || '',
10
11
  fullDescription: card.fullDescription || '',
11
12
  related: convertCategoriesToChips(card.related || [], 'categories'),
12
13
  metaDescription: card.meta_description || '',
@@ -1,4 +1,5 @@
1
1
  import type { IChannelCard, IRawChannelCard } from '../../../types';
2
+ import { ThumbSize } from '../../enums/thumb-size';
2
3
 
3
4
  export const cleanChannelCard = (card: IRawChannelCard): IChannelCard => ({
4
5
  guid: card.guid || '',
@@ -8,5 +9,5 @@ export const cleanChannelCard = (card: IRawChannelCard): IChannelCard => ({
8
9
  isNetwork: card.is_network || false,
9
10
  updated: card.updated || 0,
10
11
  avatarUrl: card.avatar_url || '',
11
- thumbUrl: card.video_thumb_urls.webp?.['480x270'] || '',
12
+ thumbUrl: card.video_thumb_urls.webp?.[ThumbSize.Big] || '',
12
13
  })
@@ -1,4 +1,5 @@
1
1
  import type { IRawChannelInfo, ICardInfo } from '../../../types';
2
+ import { ThumbSize } from '../../enums/thumb-size';
2
3
 
3
4
  export const cleanChannelInfo = (card: IRawChannelInfo): ICardInfo => ({
4
5
  guid: card.guid || '',
@@ -9,5 +10,5 @@ export const cleanChannelInfo = (card: IRawChannelInfo): ICardInfo => ({
9
10
  isNetwork: card.is_network || false,
10
11
  updated: card.updated || 0,
11
12
  avatarUrl: card.avatar_url || '',
12
- thumbUrl: card.video_thumb_urls.webp?.['480x270'] || '',
13
+ thumbUrl: card.video_thumb_urls.webp?.[ThumbSize.Big] || '',
13
14
  })
@@ -1,9 +1,10 @@
1
1
  import type { IRawModelCard, IModelCard } from '../../../types';
2
+ import { ThumbSize } from '../../enums/thumb-size';
2
3
 
3
4
  export const cleanModelCard = (card: IRawModelCard): IModelCard => ({
4
5
  title: card.title || '',
5
6
  videosCount: card.videos_count || 0,
6
- thumbUrl: card.video_thumb_urls?.webp?.['480x270'] || '',
7
+ thumbUrl: card.video_thumb_urls?.webp?.[ThumbSize.Big] || '',
7
8
  primaryImageUrl: card.primary_image_url || '',
8
9
  guid: card.guid || '',
9
10
  });
@@ -1,4 +1,5 @@
1
1
  import type { IRawModelInfo, ICardInfo } from '../../../types';
2
+ import { ThumbSize } from '../../enums/thumb-size';
2
3
 
3
4
  export const cleanModelInfo = (card: IRawModelInfo): ICardInfo => ({
4
5
  title: card.title || '',
@@ -6,6 +7,6 @@ export const cleanModelInfo = (card: IRawModelInfo): ICardInfo => ({
6
7
  social: card.social || '',
7
8
  orientation: card.orientation || '',
8
9
  videosCount: card.videos_count || 0,
9
- thumbUrl: card.video_thumb_urls?.webp?.['480x270'] || '',
10
+ thumbUrl: card.video_thumb_urls?.webp?.[ThumbSize.Big] || '',
10
11
  parameters: card.parameters || '',
11
12
  })
@@ -1,4 +1,5 @@
1
1
  import type { IRawPlaylistCard, IPlaylistCard } from '../../../types';
2
+ import { ThumbSize } from '../../enums/thumb-size';
2
3
 
3
4
  export const cleanPlaylistCard = (card: IRawPlaylistCard): IPlaylistCard => ({
4
5
  created: card.created || 0,
@@ -6,7 +7,7 @@ export const cleanPlaylistCard = (card: IRawPlaylistCard): IPlaylistCard => ({
6
7
  name: card.name || '',
7
8
  username: card.username || '',
8
9
  playlistType: card.playlist_type || '',
9
- thumbUrls: card.thumbs?.map(item => item.urls.webp?.['480x270'] || ''),
10
+ thumbUrls: card.thumbs?.map(item => item.urls.webp?.[ThumbSize.Big] || ''),
10
11
  videosCount: card.videos_count || 0,
11
12
  firstVideoId: card.first_video_id || '',
12
13
  searchTags: card.search_tags || '',
@@ -1,4 +1,5 @@
1
1
  import type { IRawVideoCard, IVideoCard } from '../../../types';
2
+ import { ThumbSize } from '../../enums/thumb-size';
2
3
 
3
4
  export const cleanVideoCard = (card: IRawVideoCard): IVideoCard => ({
4
5
  guid: card.guid || '',
@@ -13,7 +14,7 @@ export const cleanVideoCard = (card: IRawVideoCard): IVideoCard => ({
13
14
  channelName: card.channel?.name || '',
14
15
  url: card.url || '',
15
16
  previewUrl: card.preview_url || '',
16
- thumbUrl: card.thumb_urls?.webp?.['480x270'] || '',
17
+ thumbUrl: card.thumb_urls?.webp?.[ThumbSize.Big] || '',
17
18
  md5: card.md5 || '',
18
19
  thumbNum: card.thumb_number || 0,
19
20
  models: card.models?.map(item => item.title) || [],
@@ -1,4 +1,5 @@
1
1
  import type { IRawVideoData, IVideoData } from '../../../types';
2
+ import { ThumbSize } from '../../enums/thumb-size';
2
3
 
3
4
  export const cleanVideoData = (data: IRawVideoData): IVideoData => ({
4
5
  guid: data.guid || '',
@@ -18,7 +19,7 @@ export const cleanVideoData = (data: IRawVideoData): IVideoData => ({
18
19
  channelAvatar: data.channel?.avatar_url || '',
19
20
  url: data.url || '',
20
21
  previewUrl: data.preview_url || '',
21
- thumbUrl: data.thumb_urls?.webp?.['480x270'] || '',
22
+ thumbUrl: data.thumb_urls?.webp?.[ThumbSize.Big] || '',
22
23
  vttUrl: data.vtt_url || '',
23
24
  vttSpriteUrl: data.vtt_sprite_url || '',
24
25
  created: data.created || 0,
@@ -1,4 +1,5 @@
1
1
  import type { IRawModelCard, IChipsItem } from '../../../types';
2
+ import { ThumbSize } from '../../enums/thumb-size';
2
3
 
3
4
  /** Конвертация карточки модели в chips */
4
5
  export function convertModelCardToChips(
@@ -7,7 +8,7 @@ export function convertModelCardToChips(
7
8
  return items.map(item => ({
8
9
  title: item.title,
9
10
  value: item.title,
10
- icon: item.video_thumb_urls?.webp['320x180'],
11
+ icon: item.video_thumb_urls?.webp[ThumbSize.Small],
11
12
  prefix: 'models',
12
13
  }));
13
14
  }
@@ -1,13 +1,7 @@
1
+ import type { ThumbSize } from '../runtime/enums/thumb-size';
2
+
1
3
  /** Интерфейс для работы с тумбами */
2
4
  export interface IThumbUrls {
3
- jpeg: {
4
- "1280x720": string;
5
- "320x180": string;
6
- "480x270": string;
7
- };
8
- webp: {
9
- "1280x720": string;
10
- "320x180": string;
11
- "480x270": string;
12
- };
5
+ jpeg: Record<ThumbSize, string>;
6
+ webp: Record<ThumbSize, string>;
13
7
  }