diff --git a/pages/user.go b/pages/user.go index 418e149..b60dd8e 100644 --- a/pages/user.go +++ b/pages/user.go @@ -25,10 +25,7 @@ type User struct { Following int64 Followers int64 Link string - Link1 string - Link2 string - Link3 string - Link4 string + Social []string Company string Type string Contributions string @@ -144,18 +141,8 @@ func HandleUser(c *fiber.Ctx) error { Scrape.Location = e.ChildText("li[itemprop*='homeLocation'] span") Scrape.Timezone = e.ChildText("li[itemprop*='localTime'] span") Scrape.Company = e.ChildText("li[itemprop*='worksFor'] span") - // I know this is hacky, I'll get around to fixing it later -arya e.ForEach("li[itemprop*='social']", func(i int, el *colly.HTMLElement) { - switch i { - case 0: - Scrape.Link1 = el.ChildText("a.Link--primary") - case 1: - Scrape.Link2 = el.ChildText("a.Link--primary") - case 2: - Scrape.Link3 = el.ChildText("a.Link--primary") - case 3: - Scrape.Link4 = el.ChildText("a.Link--primary") - } + Scrape.Social = append(Scrape.Social, el.ChildText("a.Link--primary")) }) }) diff --git a/views/user.html b/views/user.html index 8600dde..aad9a14 100644 --- a/views/user.html +++ b/views/user.html @@ -26,18 +26,11 @@ {{ if .Link }}
{{ end }} - {{ if .Link1 }} - - {{ end }} - {{ if .Link2 }} - - {{ end }} - {{ if .Link3 }} - - {{ end }} - {{ if .Link4 }} - - {{ end }} + {{ if .Social }} + {{range .Social}} +🔗 {{.}}
+ {{ end }} + {{ end }} {{ if .Company }}🏢 {{.Company}}
{{ end }}