add commitsbehind

This commit is contained in:
Arya Kiran
2023-04-28 12:08:42 +05:30
parent 19b789a4c4
commit 7c9a180ebc
2 changed files with 6 additions and 1 deletions
+4
View File
@@ -17,6 +17,7 @@ type Repo struct {
Parent string
Stars string
Forks string
CommitsBehind string
Watchers string
Language []string
License string
@@ -77,6 +78,9 @@ func HandleRepo(c *fiber.Ctx) error {
Scrape.Tags = append(Scrape.Tags, strings.TrimPrefix(el.Attr("data-octo-dimensions"), "topic:"))
})
})
sc.OnHTML("div.Box-body div.d-flex div span", func(e *colly.HTMLElement) {
Scrape.CommitsBehind = strings.TrimSuffix(e.ChildText("a"), " commits behind")
})
sc.OnHTML("div#readme", func(e *colly.HTMLElement) {
Scrape.Readme = e.ChildText("a[href='#readme']")
})
+2 -1
View File
@@ -32,7 +32,8 @@
</p>
{{ end }} {{ if .Language }}
<p>🗒️ {{range .Language}} {{.}} {{end}}</p>
{{end}}
{{end}} {{ if .CommitsBehind }} This repository is {{.CommitsBehind}}
commits behind its parent. {{end}}
</div>
{{end}} {{ if .files}}
<div class="user-readme">