goeland instead of the script it's way easier
This commit is contained in:
BIN
homegrown/yt-email/.main.go.swp
Normal file
BIN
homegrown/yt-email/.main.go.swp
Normal file
Binary file not shown.
@@ -49,17 +49,28 @@ func main() {
|
|||||||
datestr := date.Format("2006-01-02T15:04:05Z")
|
datestr := date.Format("2006-01-02T15:04:05Z")
|
||||||
videosstr := "https://www.googleapis.com/youtube/v3/search/?channelId={{.Id}}&part={{.Part}},id&order={{.Order}}&publishedAfter={{.Date}}&key={{.Key}}"
|
videosstr := "https://www.googleapis.com/youtube/v3/search/?channelId={{.Id}}&part={{.Part}},id&order={{.Order}}&publishedAfter={{.Date}}&key={{.Key}}"
|
||||||
templ, err := template.New("test").Parse(videosstr)
|
templ, err := template.New("test").Parse(videosstr)
|
||||||
for i, val := range output {
|
if err != nil {
|
||||||
|
fmt.Println(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
for _, val := range output {
|
||||||
temp := videourl{val.Id, "snippet", "date", datestr, apikey}
|
temp := videourl{val.Id, "snippet", "date", datestr, apikey}
|
||||||
var output bytes.Buffer
|
var output bytes.Buffer
|
||||||
templ.Execute(&output, temp)
|
templ.Execute(&output, temp)
|
||||||
resp, err := http.Get(output.String())
|
resp, err := http.Get(output.String())
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println(err)
|
||||||
|
continue
|
||||||
|
}
|
||||||
body, err := io.ReadAll(resp.Body)
|
body, err := io.ReadAll(resp.Body)
|
||||||
fmt.Println(string(body))
|
if err != nil {
|
||||||
fmt.Println(i)
|
fmt.Println(err)
|
||||||
fmt.Println(err)
|
continue
|
||||||
|
}
|
||||||
|
if resp.StatusCode != 200 {
|
||||||
|
fmt.Println(resp)
|
||||||
|
} else {
|
||||||
|
fmt.Println(string(body))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
fmt.Println(output)
|
|
||||||
fmt.Println(apikey)
|
|
||||||
}
|
}
|
||||||
|
27
k8s_manifests/goeland/cronjob.yaml
Normal file
27
k8s_manifests/goeland/cronjob.yaml
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
apiVersion: batch/v1
|
||||||
|
kind: CronJob
|
||||||
|
metadata:
|
||||||
|
name: goeland
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: goeland
|
||||||
|
spec:
|
||||||
|
schedule: "0 0 * * Mon"
|
||||||
|
jobTemplate:
|
||||||
|
spec:
|
||||||
|
template:
|
||||||
|
spec:
|
||||||
|
restartPolicy: Never
|
||||||
|
volumes:
|
||||||
|
- name: config
|
||||||
|
nfs:
|
||||||
|
server: 192.168.0.99
|
||||||
|
path: /mnt/test1/media/config/goeland/
|
||||||
|
containers:
|
||||||
|
- name: goeland
|
||||||
|
image: slurdge/goeland:latest
|
||||||
|
command: ["/bin/sh"]
|
||||||
|
args: ["-c","cd / && ./goeland -c data/config.toml run"]
|
||||||
|
volumeMounts:
|
||||||
|
- name: config
|
||||||
|
mountPath: /data
|
||||||
|
|
Reference in New Issue
Block a user