Exemple #1
0
func main() {
	url := "http://developer.hatena.ne.jp"
	entry, err := hbapi.GetEntryInfo(url)
	if err != nil {
		panic(err)
	}
	fmt.Printf("%#v\n", entry)
}
Exemple #2
0
func (api HttpAPI) RequestRelatedBookmarks(url string) []Bookmark {
	info, err := hbapi.GetEntryInfo(url)
	if err != nil {
		return []Bookmark{}
	}

	bookmarks := []Bookmark{}
	for _, bookmark := range info.Related {
		bookmarks = append(bookmarks, Bookmark{
			Title: bookmark.Title,
			URL:   bookmark.URL,
			Count: bookmark.Count,
		})
	}

	return bookmarks
}
Exemple #3
0
func (api HttpAPI) RequestUserBookmark(url string) map[string]Bookmark {
	info, err := hbapi.GetEntryInfo(url)
	if err != nil {
		return map[string]Bookmark{}
	}

	ub := map[string]Bookmark{}
	for _, bookmark := range info.Bookmarks {
		ub[bookmark.User] = Bookmark{
			Title: info.Entry.Title,
			URL:   info.Entry.URL,
			Count: info.Entry.Count,
		}
	}

	return ub
}