Skip to content

Commit 2e4b4b1

Browse files
committed
Print statements galore
1 parent 3dcf078 commit 2e4b4b1

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

.github/workflows/daily-update.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
run: make build
4444

4545
- name: Scrape Astra
46-
run: ./api-tools -scrape -astra
46+
run: ./api-tools -scrape -astra -verbose
4747

4848
# - name: Parse Astra
4949
# run: ./api-tools -parse -astra

scrapers/astra.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,21 @@ func ScrapeAstra(outDir string) {
2626
log.Panic("Error loading .env file")
2727
}
2828

29+
log.Print("1")
2930
// Start chromedp
3031
chromedpCtx, cancel := utils.InitChromeDp()
32+
log.Print("2")
3133

3234
// Make output folder
3335
err := os.MkdirAll(outDir, 0777)
3436
if err != nil {
3537
panic(err)
3638
}
39+
log.Print("3")
3740

3841
days := "{" // String JSON for storing results by day
3942
firstLoop := true // To avoid adding a comma to the JSON on the first loop
43+
log.Print("4")
4044

4145
// Init http client
4246
tr := &http.Transport{
@@ -45,11 +49,13 @@ func ScrapeAstra(outDir string) {
4549
DisableCompression: true,
4650
}
4751
cli := &http.Client{Transport: tr}
52+
log.Print("5")
4853

4954
// Get cookies for auth
5055
astraHeaders := utils.RefreshAstraToken(chromedpCtx)
5156
time.Sleep(500 * time.Millisecond)
5257
cancel() // Don't need chromedp anymore
58+
log.Print("6")
5359

5460
// Starting date
5561
date := time.Now()

utils/methods.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ func RefreshToken(chromedpCtx context.Context) map[string][]string {
104104

105105
// This function signs into Astra
106106
func RefreshAstraToken(chromedpCtx context.Context) map[string][]string {
107+
log.Print("5.1")
107108
// Get username and password
108109
username, present := os.LookupEnv("LOGIN_ASTRA_USERNAME")
109110
if !present {
@@ -113,6 +114,7 @@ func RefreshAstraToken(chromedpCtx context.Context) map[string][]string {
113114
if !present {
114115
log.Panic("LOGIN_ASTRA_PASSWORD is missing from .env!")
115116
}
117+
log.Print("5.2")
116118

117119
// Sign in
118120
VPrintf("Signing in...")
@@ -132,6 +134,7 @@ func RefreshAstraToken(chromedpCtx context.Context) map[string][]string {
132134
if err != nil {
133135
panic(err)
134136
}
137+
log.Print("5.3")
135138

136139
// Save all cookies to string
137140
cookieStr := ""
@@ -156,6 +159,7 @@ func RefreshAstraToken(chromedpCtx context.Context) map[string][]string {
156159
if err != nil {
157160
panic(err)
158161
}
162+
log.Print("5.4")
159163

160164
// Return headers, copied from a request the actual site made
161165
return map[string][]string{

0 commit comments

Comments
 (0)