User contributions

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

ファイルの表示

@ -16,18 +16,19 @@ import (
)
type User struct {
Login string
Name string
Bio string
AvatarUrl string
Location string
Following int64
Followers int64
Link string
Company string
Type string
EwTwitter string
Readme string
Login string
Name string
Bio string
AvatarUrl string
Location string
Following int64
Followers int64
Link string
Company string
Type string
EwTwitter string
Contributions string
Readme string
}
type Ratelimit struct {
@ -152,6 +153,10 @@ func HandleUser(c *fiber.Ctx) error {
Scrape.Login = e.ChildText("span[itemprop*='additionalName']")
Scrape.Name = e.ChildText("span[itemprop*='name']")
})
// Contributions
sc.OnHTML("div.js-yearly-contributions", func(e *colly.HTMLElement) {
Scrape.Contributions = e.ChildText("h2")
})
} else {
sc.OnHTML("img[alt*='@"+c.Params("user")+"' i]", func(e *colly.HTMLElement) {
Scrape.AvatarUrl = e.Attr("src")

ファイルの表示

@ -20,6 +20,8 @@
{{ if .Location }}
<p>🌍 {{.Location}}</p>
{{ end }}
{{ if .Timezone }}
<p>🕑️ {{.Timezone}}</p>
{{ if .Link }}
<p>🔗 <a href="https://{{.Link}}" target="_blank">{{.Link}}</a></p>
{{ end }}
@ -29,6 +31,9 @@
{{ if .EwTwitter }}
<p>🐦 <a href="https://twitter.com/{{.EwTwitter}}" target="_blank">{{.EwTwitter}}</a></p>
{{ end }}
{{ if eq .Type "http://schema.org/Person" }}
<p>✏️ {{ if .Name }} {{.Name}} {{ else }} {{.Login}} {{ end }} has made {{.Contributions}}</p>
{{ end }}
</div>
{{ if .Bio }}