Reviewed-on: https://codeberg.org/gothub/gothub/pulls/65
このコミットが含まれているのは:
コミット
149d3aaaa6
|
@ -103,7 +103,7 @@ 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")
|
||||
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) {
|
||||
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")
|
||||
})
|
||||
} 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
|
||||
Scrape.Login = e.ChildAttr("img[alt*='@"+c.Params("user")+"' i]", "alt") // Hacky
|
||||
Scrape.Name = e.ChildText("h1.h2")
|
||||
Scrape.Bio = e.ChildText("div.color-fg-muted div")
|
||||
Scrape.AvatarUrl = e.ChildAttr("img[alt*='@"+c.Params("user")+"' i]", "src")
|
||||
// Metadata
|
||||
Scrape.Location = e.ChildText("span[itemprop*='location']")
|
||||
Scrape.Email = e.ChildText("a[itemprop*='email']")
|
||||
|
@ -139,6 +137,10 @@ func HandleUser(c *fiber.Ctx) error {
|
|||
// Followers
|
||||
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
|
||||
sc.OnHTML("div.clearfix", func(e *colly.HTMLElement) {
|
||||
e.ForEach("a[data-hovercard-type*='user'] img", func(i int, el *colly.HTMLElement) {
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
package utils
|
||||
|
||||
import (
|
||||
"github.com/tidwall/gjson"
|
||||
"io"
|
||||
"net/http"
|
||||
"os"
|
||||
"github.com/tidwall/gjson"
|
||||
)
|
||||
|
||||
func GetRequest(url string) gjson.Result {
|
||||
|
|
読み込み中…
新しいイシューから参照