NHK API Client in Go
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.drone.yml
.gitignore
LICENSE
README.md
nhk.go
nhk_test.go

README.md

gonhk - NHK API Client in Go

Build Status GoDoc

gonhk implements a NHK API client.

Installation

$ go get github.com/yosssi/gonhk

Example

package main

import (
	"fmt"
	"github.com/yosssi/gonhk"
	"time"
)

func main() {
	// Get an NHK API client. You have to pass your NHK API key to this function.
	client := gonhk.NewClient("Your NHK API Key")

	today := time.Now()

	// Call NHK Program List API.
	// http://api-portal.nhk.or.jp/doc_list-v1_con
	result1, err := client.ProgramList("v1", "130", "g1", today)
	if err != nil {
		panic(err)
	}
	fmt.Printf("%+v\n", result1)

	// Call NHK Program Genre API.
	// http://api-portal.nhk.or.jp/doc_genre-v1_con
	result2, err := client.ProgramGenre("v1", "130", "g1", "0000", today)
	if err != nil {
		panic(err)
	}
	fmt.Printf("%+v\n", result2)

	// Call NHK Program Info API.
	// http://api-portal.nhk.or.jp/doc_info-v1_con
	result3, err := client.ProgramInfo("v1", "130", "g1", "2014020702065")
	if err != nil {
		panic(err)
	}
	fmt.Printf("%+v\n", result3)

	// Call NHK Now On Air API.
	// http://api-portal.nhk.or.jp/doc_now-v1_con
	result4, err := client.NowOnAir("v1", "130", "g1")
	if err != nil {
		panic(err)
	}
	fmt.Printf("%+v\n", result4)
}

Documentation

GoDoc

Note

情報提供:NHK
This program uses NHK番組表API.