A package to retrieve trending repositories and developers from Github written in Go.
- Get trending repositories
- Get trending developers
- Get all programming languages known by GitHub
- Filtering by time and (programming) language
- Support for GitHub Enterprise
It is go gettable
$ go get github.com/andygrunwald/go-trending
or using/updating to the latest master
$ go get -u github.com/andygrunwald/go-trending@master
Please have a look at the package documentation for a detailed API description.
A few examples how the API can be used. More examples are available in the GoDoc examples section.
package main
import (
"fmt"
"github.com/andygrunwald/go-trending"
)
func main() {
trend := trending.NewTrending()
// Show projects of today
projects, err := trend.GetProjects(trending.TimeToday, "")
if err != nil {
panic(err)
}
for index, project := range projects {
i := index + 1
if len(project.Language) > 0 {
fmt.Printf("%d: %s (written in %s with %d ★ )\n", i, project.Name, project.Language, project.Stars)
} else {
fmt.Printf("%d: %s (with %d ★ )\n", i, project.Name, project.Stars)
}
}
}
package main
import (
"fmt"
"github.com/andygrunwald/go-trending"
)
func main() {
trend := trending.NewTrending()
// Show projects of today
projects, err := trend.GetProjects(trending.TimeWeek, "go")
if err != nil {
panic(err)
}
for index, project := range projects {
i := index + 1
if len(project.Language) > 0 {
fmt.Printf("%d: %s (written in %s with %d ★ )\n", i, project.Name, project.Language, project.Stars)
} else {
fmt.Printf("%d: %s (with %d ★ )\n", i, project.Name, project.Stars)
}
}
}
package main
import (
"fmt"
"github.com/andygrunwald/go-trending"
)
func main() {
trend := trending.NewTrending()
developers, err := trend.GetDevelopers(trending.TimeMonth, "swift")
if err != nil {
panic(err)
}
for index, developer := range developers {
i := index + 1
fmt.Printf("%d: %s (%s)\n", i, developer.DisplayName, developer.FullName)
}
}
package main
import (
"fmt"
"github.com/andygrunwald/go-trending"
)
func main() {
trend := trending.NewTrending()
// Show languages
languages, err := trend.GetLanguages()
if err != nil {
panic(err)
}
for index, language := range languages {
i := index + 1
fmt.Printf("%d: %s (%s)\n", i, language.Name, language.URLName)
}
}
- rochefort/git-trend (Ruby)
- sheharyarn/github-trending (Ruby)
This project is released under the terms of the MIT license.