-
Notifications
You must be signed in to change notification settings - Fork 0
/
metadata.go
74 lines (69 loc) · 2.92 KB
/
metadata.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
package metadata
// Metadata is the struct that encapsulates the extracted metadata.
type Metadata struct {
Audio Audio `json:"audio"`
Author string `json:"author"`
CanonicalURL string `json:"canonical_url"`
CleanURL string `json:"clean_url"`
Date string `json:"date"`
Description string `json:"description"`
FaviconURL string `json:"favicon_url"`
FeedURLs []string `json:"feed_url"`
HTML string `json:"html"`
IsReadable bool `json:"is_readable"`
Kind string `json:"kind"`
Lang string `json:"lang"`
LeadImageInMeta bool `json:"lead_image_in_meta"`
LeadImageURL string `json:"lead_image_url"`
Meta Meta `json:"meta"`
Publisher string `json:"publisher"`
ReadableByline string `json:"readable_byline"`
ReadableExcerpt string `json:"readable_excerpt"`
ReadableHTML string `json:"readable_html"`
ReadableImage string `json:"readable_image"`
ReadableLang string `json:"readable_lang"`
ReadableLength int `json:"readable_length"`
ReadableSiteName string `json:"readable_site_name"`
ReadableText string `json:"readable_text"`
ReadableTitle string `json:"readable_title"`
SiteName string `json:"site_name"`
Title string `json:"title"`
URL string `json:"url"`
Video Video `json:"video"`
Dynamic map[string]any `json:"dynamic"`
}
// Meta is the struct that encapsulates the extracted metadata from <meta> tags
type Meta struct {
Charset string `json:"charset"`
Viewport string `json:"viewport"`
// ... Other meta properties
}
// Image is the struct that encapsulates the extracted metadata from <img> tags
type Image struct {
URL string `json:"url"`
Type string `json:"type"`
Width int `json:"width"`
Height int `json:"height"`
Size int `json:"size"`
SizePretty string `json:"size_pretty"`
}
// Video is the struct that encapsulates the extracted metadata from <video> tags
type Video struct {
URL string `json:"url"`
Type string `json:"type"`
Duration float64 `json:"duration"`
DurationPretty string `json:"duration_pretty"`
Width int `json:"width"`
Height int `json:"height"`
Size int `json:"size"`
SizePretty string `json:"size_pretty"`
}
// Audio is the struct that encapsulates the extracted metadata from <audio> tags
type Audio struct {
URL string `json:"url"`
Type string `json:"type"`
Duration float64 `json:"duration"`
DurationPretty string `json:"duration_pretty"`
Size int `json:"size"`
SizePretty string `json:"size_pretty"`
}