A package to retrieve newly posted articles and recently stocked articles from Qiita written in golang.
This package were inspired by andygrunwald/go-trending (Go)
- Get newly posted articles
- Get recently stocked articles
- Filtering by tag and page
It is go gettable
$ go get github.com/high5/go-qiita-explore
update
$ go get -u github.com/high5/go-qiita-explore
(optional) to run unit / example tests:
$ cd $GOPATH/src/github.com/high5/go-qiita-explore
$ go test -v
package main
import (
"fmt"
"github.com/high5/go-qiita-explore"
"log"
)
func main() {
explore := explore.NewExplore()
articles, err := explore.GetStocks("Ruby")
if err != nil {
log.Fatal(err)
}
for index, article := range articles {
if index == 0 {
fmt.Println("------------------------------------------------------------------------------")
}
fmt.Printf("title: %s \n", article.Title)
fmt.Printf("url: %s \n", article.URL.String())
fmt.Printf("user: %s \n", article.UserName)
fmt.Printf("user_url: %s \n", article.UserURL.String())
fmt.Printf("stock: %d \n", article.StockCount)
fmt.Printf("created_time: %s \n", article.CreatedTime.Format("2006-01-02"))
for index, tag := range article.Tags {
tagNo := index + 1
fmt.Printf("tag%d: %s (http://qiita.com/tags/%s)\n", tagNo, tag, tag)
}
fmt.Println("------------------------------------------------------------------------------")
}
}
package main
import (
"fmt"
"github.com/high5/go-qiita-explore"
"log"
)
func main() {
explore := explore.NewExplore()
articles, err := explore.GetItems("JavaScript", 1)
if err != nil {
log.Fatal(err)
}
for index, article := range articles {
if index == 0 {
fmt.Println("------------------------------------------------------------------------------")
}
fmt.Printf("title: %s \n", article.Title)
fmt.Printf("url: %s \n", article.URL.String())
fmt.Printf("user: %s \n", article.UserName)
fmt.Printf("user_url: %s \n", article.UserURL.String())
fmt.Printf("stock: %d \n", article.StockCount)
fmt.Printf("created_time: %s \n", article.CreatedTime.Format("2006-01-02"))
for index, tag := range article.Tags {
tagNo := index + 1
fmt.Printf("tag%d: %s (http://qiita.com/tags/%s)\n", tagNo, tag, tag)
}
fmt.Println("------------------------------------------------------------------------------")
}
}
This project is released under the terms of the MIT license.