mirror of
https://codeberg.org/gothub/gothub
synced 2024-12-06 19:16:24 +01:00
add commitsbehind
This commit is contained in:
@@ -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
@@ -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">
|
||||
|
||||
Reference in New Issue
Block a user