YESSSSSSSS
This commit is contained in:
BIN
homegrown/email-rust/src/.main.rs.swp
Normal file
BIN
homegrown/email-rust/src/.main.rs.swp
Normal file
Binary file not shown.
@@ -1,11 +1,13 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
"os"
|
||||
"text/template"
|
||||
"time"
|
||||
|
||||
"github.com/joho/godotenv"
|
||||
@@ -22,6 +24,14 @@ type videos struct {
|
||||
Name string
|
||||
}
|
||||
|
||||
type videourl struct {
|
||||
Id string
|
||||
Part string
|
||||
Order string
|
||||
Date string
|
||||
Key string
|
||||
}
|
||||
|
||||
func main() {
|
||||
channellist := "https://raw.githubusercontent.com/bvanroll/home/refs/heads/master/static/yters.json"
|
||||
err := godotenv.Load()
|
||||
@@ -37,7 +47,19 @@ func main() {
|
||||
date := time.Now().Add(-week)
|
||||
//bro wtf is up with go here man this is ass :D
|
||||
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={apikey}"
|
||||
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)
|
||||
for i, val := range output {
|
||||
temp := videourl{val.Id, "snippet", "date", datestr, apikey}
|
||||
var output bytes.Buffer
|
||||
templ.Execute(&output, temp)
|
||||
resp, err := http.Get(output.String())
|
||||
body, err := io.ReadAll(resp.Body)
|
||||
fmt.Println(string(body))
|
||||
fmt.Println(i)
|
||||
fmt.Println(err)
|
||||
|
||||
}
|
||||
fmt.Println(output)
|
||||
fmt.Println(apikey)
|
||||
}
|
||||
|
Reference in New Issue
Block a user