-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.ts
78 lines (67 loc) · 1.54 KB
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import * as YouTube from './youtube'
export { YouTube }
type Meta = {
title: string
description?: string
}
export interface Artist {
id: string
playlistId: string
meta: Meta
titleParser?: (video: VideoWithComments) => string
videoParsers?: {
[key: string]: ((video: VideoWithComments) => VideoWithComments) | undefined
}
sortVideos?: (videoA: VideoWithComments, videoB: VideoWithComments) => number
commentParsers?: {
[key: string]: ((comment: VideoComment) => VideoComment) | undefined
}
omitVideoIds?: string[]
omitCommentIds?: string[]
}
export type Token = { key?: string; accessToken?: string }
export type VideoComment = Omit<
Pick<YouTube.CommentThread, 'id'>,
'snippet'
> & {
snippet: Omit<
Pick<YouTube.CommentThreadSnippet, 'videoId'>,
'topLevelComment'
> & {
topLevelComment: {
snippet: Pick<YouTube.CommentSnippet, 'publishedAt' | 'textDisplay'>
}
}
}
export type VideoWithComments = Omit<
Pick<YouTube.Video, 'id'>,
'snippet' | 'contentDetails'
> & {
contentDetails: {
duration: number
}
snippet: Pick<
YouTube.VideoSnippet,
'title' | 'description' | 'publishedAt' | 'thumbnails'
>
comments: VideoComment[]
}
export type PreloadedData = {
meta: Meta
videos: VideoWithComments[]
}
export type ParsedSong = {
name: string
start: number
}
export type ParsedVideo = {
title: string
id: string
duration: number
songs: ParsedSong[]
}
export type ResponseSuccess = {
meta: Meta
data: ParsedVideo[]
}
export type ResponseError = { error: string }