mirror of
https://codeberg.org/gothub/gothub
synced 2024-12-06 19:16:24 +01:00
add reaction support
This commit is contained in:
+10
-3
@@ -31,9 +31,8 @@ type Assets struct {
|
||||
ReleasedOn string
|
||||
}
|
||||
type Reactions struct {
|
||||
Name string
|
||||
Count string
|
||||
Reactants []string
|
||||
Name string
|
||||
Count string
|
||||
}
|
||||
|
||||
func ReleaseView(c *fiber.Ctx) error {
|
||||
@@ -84,9 +83,17 @@ func ReleaseView(c *fiber.Ctx) error {
|
||||
}
|
||||
sc.OnHTML("div.Box-footer", func(e *colly.HTMLElement) {
|
||||
Scrape.AssetCount = e.ChildText("details summary span.Counter")
|
||||
Scrape.TotalReactions = strings.TrimSuffix(e.ChildText("div.comment-reactions div.color-fg-muted"), " people reacted")
|
||||
e.ForEach("ul li", func(i int, el *colly.HTMLElement) {
|
||||
Scrape.Contributors = append(Scrape.Contributors, strings.TrimPrefix(el.ChildAttr("a img", "alt"), "@"))
|
||||
})
|
||||
e.ForEach("div.js-comment-reactions-options button", func(i int, el *colly.HTMLElement) {
|
||||
Scrape.Reactions = append(Scrape.Reactions, Reactions{
|
||||
Name: el.ChildText("g-emoji"),
|
||||
Count: el.ChildText("span.js-discussion-reaction-group-count"),
|
||||
})
|
||||
})
|
||||
|
||||
})
|
||||
sc.Visit("https://github.com/" + c.Params("user") + "/" + c.Params("repo") + "/releases/" + c.Params("release"))
|
||||
// Add scrape-based info to releaseArray
|
||||
|
||||
Reference in New Issue
Block a user