diff --git a/pages/user.go b/pages/user.go index de9e5d9..d2aa65e 100644 --- a/pages/user.go +++ b/pages/user.go @@ -74,7 +74,6 @@ func HandleUser(c *fiber.Ctx) error { }) } else { - if user.Get("blog").String() == "" { link = "" } else { @@ -111,9 +110,8 @@ func HandleUser(c *fiber.Ctx) error { // scraping Scrape := User{ - Link: link, - EwTwitter: user.Get("twitter_username").String(), - Readme: string(readmeOutput), + Link: link, + Readme: string(readmeOutput), } sc1 := colly.NewCollector(colly.AllowedDomains("github.com")) @@ -140,6 +138,7 @@ func HandleUser(c *fiber.Ctx) error { sc.OnHTML("ul.vcard-details", func(e *colly.HTMLElement) { Scrape.Location = e.ChildText("li[itemprop*='homeLocation'] span") Scrape.Company = e.ChildText("li[itemprop*='worksFor'] span") + Scrape.EwTwitter = e.ChildText("a[href*='https://twitter.com/' i]") }) // Followers/Following sc.OnHTML("a[href*='https://github.com/"+c.Params("user")+"?tab=followers' i]", func(e *colly.HTMLElement) { @@ -153,7 +152,6 @@ func HandleUser(c *fiber.Ctx) error { Scrape.Login = e.ChildText("span[itemprop*='additionalName']") Scrape.Name = e.ChildText("span[itemprop*='name']") }) - } else { sc.OnHTML("img[alt*='@"+c.Params("user")+"' i]", func(e *colly.HTMLElement) { Scrape.AvatarUrl = e.Attr("src") @@ -161,6 +159,7 @@ func HandleUser(c *fiber.Ctx) error { log.Println("Bio and Location routes cannot be scraped for organizations") } sc.Visit("https://github.com/" + c.Params("user") + "/") + Scrape.EwTwitter = strings.Trim(Scrape.EwTwitter, "@") userArray = append(userArray, Scrape) return c.Render("user", fiber.Map{