diff --git a/core/internal/handlers/tvshow.go b/core/internal/handlers/tvshow.go index 041e16d..96f94dc 100644 --- a/core/internal/handlers/tvshow.go +++ b/core/internal/handlers/tvshow.go @@ -14,6 +14,8 @@ func (hq *Handlers) GetTVShow(c *gin.Context) { seasons := scraper.ScrapeSeasons(ttShowID) + slog.Info("scraped seasons", "ttid", ttShowID) + c.JSON(http.StatusOK, gin.H{ "seasons": seasons, }) diff --git a/core/internal/scraper/tvshow.go b/core/internal/scraper/tvshow.go index 0088896..44d4ca7 100644 --- a/core/internal/scraper/tvshow.go +++ b/core/internal/scraper/tvshow.go @@ -34,7 +34,6 @@ func ScrapeSeasons(ttImdb string) []Season { colly.AllowedDomains("imdb.com", "www.imdb.com"), ) - //var allEpisodes []Episode var allSeasons []Season var seasons []int @@ -49,6 +48,7 @@ func ScrapeSeasons(ttImdb string) []Season { c.OnScraped(func(r *colly.Response) { seasonMap := make(map[int]bool) uniqueSeasons := []int{} + slog.Info("scraped seasons", "seasons", seasons) for _, seasonNum := range seasons { if !seasonMap[seasonNum] { seasonMap[seasonNum] = true @@ -75,7 +75,7 @@ func ScrapeSeasons(ttImdb string) []Season { episodeCollector.Wait() }) - c.Visit("https://www.imdb.com/title/tt0903747/episodes") + c.Visit(fmt.Sprintf("https://www.imdb.com/title/%s/episodes", ttImdb)) c.Wait() return allSeasons