res, err := http.Get(episode.VideoUrl)
if err != nil {
logger.Println(err)
report := Report{"newEpisodes", err.Error()}
bot.reportToChannel(report)
continue
}
if res.StatusCode != 200 {
logger.Println(err)
report := Report{"newEpisodes", err.Error()}
bot.reportToChannel(report)
continue
}
p, listType, err := m3u8.DecodeFrom(res.Body, false)
if err != nil {
logger.Println(err)
report := Report{"newEpisodes", err.Error()}
bot.reportToChannel(report)
continue
}
if listType != m3u8.MASTER {
logger.Println("Playlist is not Master", episode.VideoUrl)
report := Report{"Playlist is not Master", episode.VideoUrl}
bot.reportToChannel(report)
continue
}
videoUrl, ok := findX480Url(p.(*m3u8.MasterPlaylist).Variants)
if ok == false {
logger.Println("No 480p", episode.VideoUrl)
report := Report{"No 480p", episode.VideoUrl}
bot.reportToChannel(report)
continue
}