forked from worksinmagic/ytfeed
-
Notifications
You must be signed in to change notification settings - Fork 0
/
data.go
61 lines (51 loc) · 1.59 KB
/
data.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
package ytfeed
import (
"context"
"encoding/json"
)
type DataHandlerFunc func(ctx context.Context, d *Data)
type Data struct {
Feed Feed `json:"feed"`
OriginalXMLMessage string `json:"original_xml_message,omitempty"`
}
func (d *Data) String() string {
tmp := d.OriginalXMLMessage
d.OriginalXMLMessage = ""
str, _ := json.Marshal(d)
d.OriginalXMLMessage = tmp
return string(str)
}
type Feed struct {
YT string `json:"-yt,omitempty"`
XMLNS string `json:"-xmlns"`
DeletedEntry DeletedEntry `json:"deleted-entry,omitempty"`
At string `json:"-at,omitempty"`
Title string `json:"title,omitempty"`
Updated string `json:"updated,omitempty"` // 2020-07-29T10:12:08.794405158+00:00
Link []Link `json:"link,omitempty"`
Entry Entry `json:"entry,omitempty"`
}
type DeletedEntry struct {
Ref string `json:"-ref,omitempty"`
When string `json:"-when,omitempty"` // "2020-07-29T16:46:32+00:00"
Link Link `json:"link,omitempty"`
By Author `json:"by,omitempty"`
}
type Link struct {
Rel string `json:"-rel,omitempty"`
Href string `json:"-href"`
}
type Entry struct {
Title string `json:"title"`
Link Link `json:"link"`
Author Author `json:"author"`
Published string `json:"published"` // 2020-07-29T10:12:08.794405158+00:00
Updated string `json:"updated"` // 2020-07-29T10:12:08.794405158+00:00
ID string `json:"id"`
VideoID string `json:"videoId"`
ChannelID string `json:"channelId"`
}
type Author struct {
Name string `json:"name"`
URI string `json:"uri"`
}