scrape twitter

このコミットが含まれているのは:
Arya Kiran 2023-02-08 18:37:13 +05:30
コミット fc19decc13
この署名に対応する既知のキーがデータベースに存在しません
GPGキーID: 842D12BDA50DF120
1個のファイルの変更4行の追加5行の削除

ファイルの表示

@ -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{