-
Notifications
You must be signed in to change notification settings - Fork 0
/
response.go
84 lines (77 loc) · 2.21 KB
/
response.go
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
79
80
81
82
83
84
package ytsearch
type itemSectionRenderer struct {
Contents []struct {
VideoRenderer struct {
VideoID string `json:"videoId"`
Thumbnail struct {
Thumbnails []Thumbnail `json:"thumbnails"`
} `json:"thumbnail"`
Title struct {
Runs []struct {
Text string `json:"text"`
} `json:"runs"`
} `json:"title"`
ViewCountText struct {
SimpleText string `json:"simpleText"`
} `json:"viewCountText"`
LengthText struct {
SimpleText string `json:"simpleText"`
} `json:"lengthText"`
OwnerText struct {
Runs []struct {
Text string `json:"text"`
} `json:"runs"`
} `json:"ownerText"`
} `json:"videoRenderer"`
} `json:"contents"`
}
type continuationItemRenderer struct {
ContinuationEndpoint struct {
ContinuationCommand struct {
Token string `json:"token"`
} `json:"continuationCommand"`
} `json:"continuationEndpoint"`
}
// Innertube's raw response
type innertubeRawResponse struct {
Contents struct {
TwoColumnSearchResultsRenderer struct {
PrimaryContents struct {
SectionListRenderer struct {
Contents []struct {
ItemSectionRenderer *itemSectionRenderer `json:"itemSectionRenderer,omitempty"`
ContinuationItemRenderer *continuationItemRenderer `json:"continuationItemRenderer,omitempty"`
} `json:"contents"`
} `json:"sectionListRenderer"`
} `json:"primaryContents"`
} `json:"twoColumnSearchResultsRenderer"`
} `json:"contents"`
OnResponseReceivedCommands []struct {
AppendContinuationItemsAction struct {
ContinuationItems []struct {
ItemSectionRenderer *itemSectionRenderer `json:"itemSectionRenderer,omitempty"`
ContinuationItemRenderer *continuationItemRenderer `json:"continuationItemRenderer,omitempty"`
} `json:"continuationItems"`
} `json:"appendContinuationItemsAction"`
} `json:"onResponseReceivedCommands"`
}
// Video info
type VideoInfo struct {
VideoID string
Title string
Channel string
Thumbnails []Thumbnail
Views string
Duration string
}
// Thumbnail
type Thumbnail struct {
URL string `json:"url"`
Width uint `json:"width"`
Height uint `json:"height"`
}
// Search Response
type SearchResponse struct {
Results []VideoInfo
Continuation string
}