-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
media.go
59 lines (53 loc) · 1.79 KB
/
media.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
package main
import (
"encoding/json"
"net/http"
)
type Recording struct {
ConferenceURL string `json:"conference_url"`
EventURL string `json:"event_url"`
Filename string `json:"filename"`
Folder string `json:"folder"`
Height int64 `json:"height"`
HighQuality bool `json:"high_quality"`
Language string `json:"language"`
Length int64 `json:"length"`
MimeType string `json:"mime_type"`
RecordingURL string `json:"recording_url"`
Size int64 `json:"size"`
State string `json:"state"`
UpdatedAt string `json:"updated_at"`
URL string `json:"url"`
Width int64 `json:"width"`
}
type Media struct {
ConferenceURL string `json:"conference_url"`
Date string `json:"date"`
Description string `json:"description"`
FrontendLink string `json:"frontend_link"`
GUID string `json:"guid"`
Length int64 `json:"length"`
Link string `json:"link"`
OriginalLanguage string `json:"original_language"`
Persons []string `json:"persons"`
PosterURL string `json:"poster_url"`
Recordings []Recording `json:"recordings"`
ReleaseDate string `json:"release_date"`
Slug string `json:"slug"`
Subtitle string `json:"subtitle"`
Tags []string `json:"tags"`
ThumbURL string `json:"thumb_url"`
Title string `json:"title"`
UpdatedAt string `json:"updated_at"`
URL string `json:"url"`
}
func findMedia(url string) (Media, error) {
media := Media{}
r, err := http.Get(url)
if err != nil {
return media, err
}
defer r.Body.Close()
err = json.NewDecoder(r.Body).Decode(&media)
return media, err
}