go-trending

Go library for accessing trending repositories and developers at Github.

  • 所有者: andygrunwald/go-trending
  • 平台:
  • 許可證: MIT License
  • 分類:
  • 主題:
  • 喜歡:
    0
      比較:

Github星跟蹤圖

go-trending

GoDoc
Build Status
Go Report Card

A package to retrieve trending repositories and developers from Github written in golang.

trending package showcase

This package were inspired by rochefort/git-trend (Ruby) and sheharyarn/github-trending (Ruby).

Features

  • Get trending repositories
  • Get trending developers
  • Get trending languages
  • Get all programming languages known by GitHub
  • Filtering by time and (programming) language
  • Support for GitHub Enterprise

Installation

It is go gettable

$ go get github.com/andygrunwald/go-trending

(optional) to run unit / example tests:

$ cd $GOPATH/src/github.com/andygrunwald/go-trending
$ go test -v

API

Please have a look at the GoDoc documentation for a detailed API description.

Examples

Further a few examples how the API can be used.
A few more examples are available in the GoDoc examples section.

package main

import (
	"fmt"
	"github.com/andygrunwald/go-trending"
	"log"
)

func main() {
	trend := trending.NewTrending()

	// Show projects of today
	projects, err := trend.GetProjects(trending.TimeToday, "")
	if err != nil {
		log.Fatal(err)
	}
	for index, project := range projects {
		no := index + 1
		if len(project.Language) > 0 {
			fmt.Printf("%d: %s (written in %s with %d ★ )\n", no, project.Name, project.Language, project.Stars)
		} else {
			fmt.Printf("%d: %s (with %d ★ )\n", no, project.Name, project.Stars)
		}
	}
}
package main

import (
	"fmt"
	"github.com/andygrunwald/go-trending"
	"log"
)

func main() {
	trend := trending.NewTrending()

	// Show projects of today
	projects, err := trend.GetProjects(trending.TimeWeek, "go")
	if err != nil {
		log.Fatal(err)
	}
	for index, project := range projects {
		no := index + 1
		if len(project.Language) > 0 {
			fmt.Printf("%d: %s (written in %s with %d ★ )\n", no, project.Name, project.Language, project.Stars)
		} else {
			fmt.Printf("%d: %s (with %d ★ )\n", no, project.Name, project.Stars)
		}
	}
}
package main

import (
	"fmt"
	"github.com/andygrunwald/go-trending"
	"log"
)

func main() {
	trend := trending.NewTrending()

	developers, err := trend.GetDevelopers(trending.TimeMonth, "swift")
	if err != nil {
		log.Fatal(err)
	}
	for index, developer := range developers {
		no := index + 1
		fmt.Printf("%d: %s (%s)\n", no, developer.DisplayName, developer.FullName)
	}
}

List available languages

package main

import (
	"fmt"
	"github.com/andygrunwald/go-trending"
	"log"
)

func main() {
	trend := trending.NewTrending()

	// Show languages
	languages, err := trend.GetLanguages()
	if err != nil {
		log.Fatal(err)
	}
	for index, language := range languages {
		no := index + 1
		fmt.Printf("%d: %s (%s)\n", no, language.Name, language.URLName)
	}
}

Implementations

License

This project is released under the terms of the MIT license.

主要指標

概覽
名稱與所有者andygrunwald/go-trending
主編程語言Go
編程語言Go (語言數: 2)
平台
許可證MIT License
所有者活动
創建於2015-07-04 08:06:48
推送於2025-04-17 15:31:59
最后一次提交2025-04-17 23:31:58
發布數0
用户参与
星數145
關注者數8
派生數21
提交數179
已啟用問題?
問題數5
打開的問題數1
拉請求數40
打開的拉請求數0
關閉的拉請求數16
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?