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
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bytes"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
|
"text/template"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/joho/godotenv"
|
"github.com/joho/godotenv"
|
||||||
@@ -22,6 +24,14 @@ type videos struct {
|
|||||||
Name string
|
Name string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type videourl struct {
|
||||||
|
Id string
|
||||||
|
Part string
|
||||||
|
Order string
|
||||||
|
Date string
|
||||||
|
Key string
|
||||||
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
channellist := "https://raw.githubusercontent.com/bvanroll/home/refs/heads/master/static/yters.json"
|
channellist := "https://raw.githubusercontent.com/bvanroll/home/refs/heads/master/static/yters.json"
|
||||||
err := godotenv.Load()
|
err := godotenv.Load()
|
||||||
@@ -37,7 +47,19 @@ func main() {
|
|||||||
date := time.Now().Add(-week)
|
date := time.Now().Add(-week)
|
||||||
//bro wtf is up with go here man this is ass :D
|
//bro wtf is up with go here man this is ass :D
|
||||||
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={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(output)
|
||||||
fmt.Println(apikey)
|
fmt.Println(apikey)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user