How to use the NHK program guide API

Introduction

I want to use a slightly minor API ... So, I summarized the memos when using the NHK program guide API. I was worried that registration would be a hassle, but it was surprisingly easy to proceed from registration to use.

User registration

  1. Access the NHK Program Guide API Page. image.png
  2. Click [Click here if you have not completed user registration] to enter the user registration screen.
  3. Select the [Create Account] tab, fill in the following items, and click [Create Account].
  1. You will receive a temporary registration completion email at the above email address in about 5 minutes.
  1. Go to the URL in the email and change (set) your password to complete the registration.

App registration

The following procedure assumes that you are logged in to the NHK program guide API page.

  1. Access the NHK Program Guide API page and click [Click here for registered apps].
  2. Select the My Apps tab and click New App Registration.
  3. Fill in the following items and click [Create App] to register the app.

Get API key

The following procedure assumes that you are logged in to the NHK program guide API page.

  1. Access the NHK Program Guide API page and click [Click here for registered apps].
  2. Select the [My Apps] tab and click the app name you registered earlier.
  3. You can get the API key by selecting the [Key] tab on the destination page.

API usage example

nhk_api.sh


#!/bin/bash
​
json=$(curl -s http://api.nhk.or.jp/v2/pg/now/130/g1.json?key={Your API key})
​
echo '[Programs currently on air]'
echo 'Channel:'$(echo ${json} | jq '.nowonair_list.g1.present.service.name' | sed 's/\"//g')
echo 'Program name:'$(echo ${json} | jq '.nowonair_list.g1.present.title' | sed 's/\"//g')
echo 'subtitle:'$(echo ${json} | jq '.nowonair_list.g1.present.subtitle' | sed 's/\"//g')

Output result


[Programs currently on air]
Channel: NHK General 1
Program name: News Watch 9 ▽ Japan Post Insurance 12,800 inappropriate sales, the actual situation is ...
Subtitle: ▽ Report card at the beginning of the year? System failure in 53 local governments nationwide ▽ Japan Life Creditors Meeting Request for explanation to the Prime Minister ▽ Gundam Director Tomino Message to young people ▽ Hanyu Kihei to all Japan

important point

image.png

Recommended Posts

How to use the NHK program guide API
How to use the Google Cloud Translation API
How to use the generator
How to use the decorator
How to start the program
How to use the zip function
How to use the optparse module
How to use OpenPose's Python API
How to use bing search api
How to use the ConfigParser module
[Python] How to use Typetalk API
I made an original program guide using the NHK program guide API.
How to use FastAPI ① Tutorial --User Guide
How to use the Spark ML pipeline
How to use FastAPI ② Advanced --User Guide
[Linux] How to use the echo command
How to use the Linux grep command
How to use the IPython debugger (ipdb)
How to use GCP's Cloud Vision API
How to use xml.etree.ElementTree
How to use Python-shell
From the introduction of GoogleCloudPlatform Natural Language API to how to use it
How to use tf.data
How to use virtualenv
How to use MkDocs for the first time
How to use Seaboan
How to use image-match
How to use shogun
How to use Pandas 2
How to use Virtualenv
How to use numpy.vectorize
Use the MediaWiki API to get Wiki information
How to use partial
How to use Bio.Phylo
How to use the graph drawing library Bokeh
How to use SymPy
How to use WikiExtractor.py
How to use IPython
How to use virtualenv
How to use Matplotlib
[Algorithm x Python] How to use the list
How to use iptables
How to use numpy
How to use TokyoTechFes2015
How to use venv
How to use dictionary {}
How to use Pyenv
How to use list []
How to use python-kabusapi
How to use OptParse
How to use return
How to use dotenv
How to use pyenv-virtualenv
How to use Go.mod
How to use imutils
How to use import
Think about how to program Python on the iPad
How to use the Raspberry Pi relay module Python
Linux user addition, how to use the useradd command
How to use the grep command and frequent samples
[Introduction to Udemy Python3 + Application] 27. How to use the dictionary