Skip to content

yukihir0/hbapi

Repository files navigation

hbapi Build Status Coverage Status

"hbapi" is library for hatena bookmark api.

Install

go get github.com/yukihir0/hbapi

How to use

Use official API

Hatena Bookmark Entry Information API

url := "..."
entry, _ := hbapi.GetEntryInfo(url)
fmt.Println(entry.Count)

Hatena Bookmark Count API

// single url
url := "..."
count, _ := hbapi.GetBookmarkCount(url)
fmt.Printf("%s : %d\n", url, count)

// mutiple url
urls := []string{"...", "...", "..."}
counts, _ := hbapi.GetBookmarkCounts(urls)
for url, count := range counts {
  fmt.Printf("%s : %d\n", url, count)
}

Hatena Bookmark Feed

user := "..."
params := hbapi.NewFeedParams(user)
feed, _ := hbapi.GetFeed(params)
for _, item := range feed.Items {
	fmt.Println(item.Title)
}

Hatena Bookmark Favorite Feed

user := "..."
params := hbapi.NewFavoriteFeedParams(user)
feed, _ := hbapi.GetFavoriteFeed(params)
for _, item := range feed.Items {
	fmt.Println(item.Title)
}

Use unofficial API

Hatena Bookmark Hot Entry Feed

params := hbapi.NewHotEntryFeedParams()
feed, _ := hbapi.GetHotEntryFeed(params)
for _, item := range feed.Items {
  fmt.Println(item.Title)
}

Hatena Bookmark Search Feed

query := "golang"
params := hbapi.NewSearchFeedParams(query)
feed, _ := hbapi.GetSearchFeed(params)
for _, item := range feed.Items {
  fmt.Println(item.Title)
}

License

Copyright © 2015 yukihir0

About

"hbapi" is library for hatena bookmark api.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages