コミット
11def08969
|
@ -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 {
|
||||||
|
|
読み込み中…
新しいイシューから参照