-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
executable file
·68 lines (54 loc) · 2 KB
/
main.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
package main
import (
"os"
"log"
"github.com/cbroglie/mustache"
"fmt"
"encoding/json"
)
type Session struct {
SessionId string
Title string
Abstract string
YoutubeUrl string
SlideshareUrl string
}
type AllSessions struct {
Sessions []Session
}
// look at view:source and look for data-channel-external-id="XXXX"
const amazonWebServicesChannelExternalId = "UCd6MoB9NC6uYN2grvUNT-Zg"
const awsSlideShareUsername = "AmazonWebServices"
var tracks = [...]string{"ALX", "ARC", "BDA", "BDM", "BAP", "CMP", "CON", "CTD", "DAT", "DCS", "DEV", "ENT",
"FIN", "GAM", "HLC", "IOT", "LFS", "MAC", "MAE", "MBL", "NET", "SAC", "SEC", "SVR", "STG", "WIN", "WWPS"}
func main() {
var sessions []Session
for _, track := range tracks {
trackSessions := parse(track)
//for _, session := range trackSessions {
// log.Printf("Session: %s, %s, %s, %s, %s", session.SessionId, session.Title, session.Abstract, session.SlideshareUrl, session.YoutubeUrl)
//}
sessions = append(sessions, trackSessions...)
}
ytDevKey := os.Getenv("YOUTUBE_DEVKEY")
ssApiKey := os.Getenv("SLIDESHARE_APIKEY")
ssSecret := os.Getenv("SLIDESHARE_SECRET")
cacheSlideSharesByUsername(awsSlideShareUsername, ssApiKey, ssSecret)
for sessionIndex, session := range sessions {
slideShowUrl := searchOnUserForKeyword(awsSlideShareUsername, session.SessionId, ssApiKey, ssSecret)
youtubeUrl := searchOnChannelByKeyword(amazonWebServicesChannelExternalId, session.SessionId, ytDevKey)
(&sessions[sessionIndex]).SlideshareUrl = slideShowUrl
(&sessions[sessionIndex]).YoutubeUrl = youtubeUrl
}
for _, session := range sessions {
log.Printf("Session: %s, %s, %s, %s, %s", session.SessionId, session.Title, session.Abstract, session.SlideshareUrl, session.YoutubeUrl)
}
mustacheSessions := AllSessions{Sessions: sessions}
b, _ := json.Marshal(mustacheSessions)
fmt.Println(string(b))
output, err := mustache.RenderFile("resources/out.mustache", mustacheSessions)
if err != nil {
log.Fatalf("error running mustache %v", err)
}
fmt.Print(output)
}