Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 0 additions & 19 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
"syscall"
"time"

"github.com/chromedp/cdproto/network"
"github.com/chromedp/chromedp"
"github.com/nicklaw5/helix/v2"
"github.com/prometheus/client_golang/prometheus/promhttp"
Expand Down Expand Up @@ -384,17 +383,6 @@ func streamWebpage(ctx context.Context, config *Config) error {
// Start Chrome and navigate to webpage
logger.Info("Starting Chrome browser", zap.String("url", config.WebpageURL))

// Capture the status code when the page loads
var statusCode int64
chromedp.ListenTarget(chromeCtx, func(ev interface{}) {
switch ev := ev.(type) {
case *network.EventResponseReceived:
if ev.Response.URL == config.WebpageURL {
statusCode = ev.Response.Status
}
}
})

// Load the page
if err := chromedp.Run(chromeCtx,
chromedp.Navigate(config.WebpageURL),
Expand All @@ -403,13 +391,6 @@ func streamWebpage(ctx context.Context, config *Config) error {
return fmt.Errorf("failed to navigate to webpage: %v", err)
}

// Log the page load result based on status code
if statusCode >= 200 && statusCode < 300 {
logger.Info("Page load completed successfully", zap.String("url", config.WebpageURL), zap.Int64("status_code", statusCode))
} else {
logger.Fatal("Page load failed with error status, terminating program", zap.String("url", config.WebpageURL), zap.Int64("status_code", statusCode))
}

// Wait a moment for the page to fully load
time.Sleep(3 * time.Second)

Expand Down