diff --git a/pages/release.go b/pages/release.go index 610f476..1d63b04 100644 --- a/pages/release.go +++ b/pages/release.go @@ -75,15 +75,17 @@ func ReleaseView(c *fiber.Ctx) error { Content, _ := e.DOM.Html() Scrape.ReleaseContent = strings.Replace(strings.Replace(strings.Replace(strings.Replace(string(utils.UGCPolicy().SanitizeBytes([]byte(Content))), "https://github.com", "", -1), "user-content-", "", -1), "https://camo.githubusercontent.com", "/camo", -1), "https://raw.githubusercontent.com", "/raw", -1) }) + // Check if the release notes are in
 form if it isn't markdown
+	if Scrape.ReleaseContent == "" {
+		sc.OnHTML("div.Box-body pre", func(e *colly.HTMLElement) {
+			Content, _ := e.DOM.Html()
+			Scrape.ReleaseContent = "
" + strings.Replace(strings.Replace(strings.Replace(strings.Replace(string(utils.UGCPolicy().SanitizeBytes([]byte(Content))), "https://github.com", "", -1), "user-content-", "", -1), "https://camo.githubusercontent.com", "/camo", -1), "https://raw.githubusercontent.com", "/raw", -1) + "
" + }) + } sc.OnHTML("div.Box-footer", func(e *colly.HTMLElement) { Scrape.AssetCount = e.ChildText("details summary span.Counter") e.ForEach("ul li", func(i int, el *colly.HTMLElement) { - Scrape.Assets = append(Scrape.Assets, Assets{ - Name: el.ChildText("div.flex-justify-start a span.text-bold"), - Link: el.ChildAttr("div.flex-justify-start a", "href"), - Size: el.ChildText("div.flex-justify-end span.text-sm-left"), - ReleasedOn: el.ChildText("div.flex-justify-end span.text-right relative-time"), - }) + Scrape.Contributors = append(Scrape.Contributors, strings.TrimPrefix(el.ChildAttr("a img", "alt"), "@")) }) }) sc.Visit("https://github.com/" + c.Params("user") + "/" + c.Params("repo") + "/releases/" + c.Params("release"))