fix organization info

I dont know why it happened but i fixed it
このコミットが含まれているのは:
Arya Kiran 2023-02-14 15:22:53 +05:30
コミット 11def08969
この署名に対応する既知のキーがデータベースに存在しません
GPGキーID: 842D12BDA50DF120
2個のファイルの変更7行の追加5行の削除

ファイルの表示

@ -103,7 +103,7 @@ func HandleUser(c *fiber.Ctx) error {
Scrape.Location = e.ChildText("li[itemprop*='homeLocation'] span") Scrape.Location = e.ChildText("li[itemprop*='homeLocation'] span")
Scrape.Timezone = e.ChildText("li[itemprop*='localTime'] span") Scrape.Timezone = e.ChildText("li[itemprop*='localTime'] span")
Scrape.Company = e.ChildText("li[itemprop*='worksFor'] span") Scrape.Company = e.ChildText("li[itemprop*='worksFor'] span")
Scrape.Link = e.ChildText("a[itemprop*='url']") Scrape.Link = e.ChildText("li[itemprop*='url'] a")
e.ForEach("li[itemprop*='social']", func(i int, el *colly.HTMLElement) { e.ForEach("li[itemprop*='social']", func(i int, el *colly.HTMLElement) {
Scrape.Social = append(Scrape.Social, el.ChildText("a.Link--primary")) Scrape.Social = append(Scrape.Social, el.ChildText("a.Link--primary"))
}) })
@ -123,12 +123,10 @@ func HandleUser(c *fiber.Ctx) error {
Scrape.Contributions = e.ChildText("h2") Scrape.Contributions = e.ChildText("h2")
}) })
} else { } else {
sc.OnHTML("div.container-xl div.flex-md-items-center", func(e *colly.HTMLElement) { sc.OnHTML("div.container-xl div.flex-md-items-center div.flex-1", func(e *colly.HTMLElement) {
// Main info // Main info
Scrape.Login = e.ChildAttr("img[alt*='@"+c.Params("user")+"' i]", "alt") // Hacky
Scrape.Name = e.ChildText("h1.h2") Scrape.Name = e.ChildText("h1.h2")
Scrape.Bio = e.ChildText("div.color-fg-muted div") Scrape.Bio = e.ChildText("div.color-fg-muted div")
Scrape.AvatarUrl = e.ChildAttr("img[alt*='@"+c.Params("user")+"' i]", "src")
// Metadata // Metadata
Scrape.Location = e.ChildText("span[itemprop*='location']") Scrape.Location = e.ChildText("span[itemprop*='location']")
Scrape.Email = e.ChildText("a[itemprop*='email']") Scrape.Email = e.ChildText("a[itemprop*='email']")
@ -139,6 +137,10 @@ func HandleUser(c *fiber.Ctx) error {
// Followers // Followers
Scrape.Followers, err = strconv.ParseInt(e.ChildText("a[href*='/orgs/"+c.Params("user")+"/followers' i] span"), 10, 64) Scrape.Followers, err = strconv.ParseInt(e.ChildText("a[href*='/orgs/"+c.Params("user")+"/followers' i] span"), 10, 64)
}) })
sc.OnHTML("img[alt*='@"+c.Params("user")+"' i]", func(e *colly.HTMLElement) {
Scrape.AvatarUrl = e.Attr("src")
Scrape.Login = e.Attr("alt")
})
// Org Members // Org Members
sc.OnHTML("div.clearfix", func(e *colly.HTMLElement) { sc.OnHTML("div.clearfix", func(e *colly.HTMLElement) {
e.ForEach("a[data-hovercard-type*='user'] img", func(i int, el *colly.HTMLElement) { e.ForEach("a[data-hovercard-type*='user'] img", func(i int, el *colly.HTMLElement) {

ファイルの表示

@ -1,10 +1,10 @@
package utils package utils
import ( import (
"github.com/tidwall/gjson"
"io" "io"
"net/http" "net/http"
"os" "os"
"github.com/tidwall/gjson"
) )
func GetRequest(url string) gjson.Result { func GetRequest(url string) gjson.Result {