Skip to content

Commit 45fb9b5

Browse files
committed
Better coursebook scraper logging
1 parent ca98adb commit 45fb9b5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

scrapers/coursebook.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ func ScrapeCoursebook(term string, startPrefix string, outDir string) {
9090
}
9191
return err
9292
}, 10, func(numRetries int) {
93-
log.Printf("WARN: Section find for course prefix %s failed! Response code was: %s", coursePrefix, res.Status)
93+
log.Printf("WARN: Section find for course prefix %s failed! Performing retry #%d...", coursePrefix, numRetries)
9494
coursebookHeaders = utils.RefreshToken(chromedpCtx)
9595
// Wait proportionally long to how many times we've retried; generally works pretty well
9696
time.Sleep(500 * time.Millisecond * time.Duration(numRetries))
@@ -140,7 +140,7 @@ func ScrapeCoursebook(term string, startPrefix string, outDir string) {
140140
}
141141
return err
142142
}, 10, func(numRetries int) {
143-
log.Printf("WARN: Section id lookup for id %s failed! Response code was: %s", id, res.Status)
143+
log.Printf("WARN: Section id lookup for id %s failed! Performing retry #%d...", id, numRetries)
144144
coursebookHeaders = utils.RefreshToken(chromedpCtx)
145145
// Wait proportionally long to how many times we've retried; generally works pretty well
146146
time.Sleep(500 * time.Millisecond * time.Duration(numRetries))
@@ -171,7 +171,7 @@ func ScrapeCoursebook(term string, startPrefix string, outDir string) {
171171
}
172172
sectionsInCoursePrefix++
173173
}
174-
log.Printf("\nFinished scraping course prefix %s. Got %d sections.", coursePrefix, sectionsInCoursePrefix)
174+
log.Printf("Finished scraping course prefix %s. Got %d sections.\n----------------------------------------------------", coursePrefix, sectionsInCoursePrefix)
175175
// Panic if we got fewer sections than we should've
176176
if sectionsInCoursePrefix != len(sectionIDs) {
177177
log.Panicf("Section count mismatch! Coursebook has %d sections for course prefix %s but we only got %d", sectionsInCoursePrefix, coursePrefix, sectionsInCoursePrefix)

0 commit comments

Comments
 (0)