NHK Programming Downloader

NHK Programming Downloader

spectroman
spectroman
13 views

Me love some Japan!

When I was really really young, myabe going to the third year on school I used to watch Spectremen on TV. I used to fake being sick so I could watch Spectremen on TV, something that didn't work all the time... But that was a start from creating this imprint on the back of my head :)

I became a fanatic, like many people around the world were also fanatics about all sorts of Japanese ideas, storytelling, comics, food, technology and on and on. My thing was Spectremen!

spectremen.png

I liked him so much that you can see him here in my website, and my general alias on the internet always was Spectroman, as much my home network I call... SpectroNET.

I guess because of the distance and the prohibitive reality that being unable to visit japan and getting in touch with the society and all the cultural knowledge, I turned to consume all the documentary, programming and anything I could put my hands on.

When I could get a stable system running where I can download things and watch on TV, I could turn my attention to downloading programming in english directly from Japan.

So I could develop my loving feelings for Japan even further, just like Spectremen, who used to fight pollution showing his "love" for Japan and Earth , for the monsters borned out of pollution.

spectremen-loving.png

So TL;DR I kept evolving, now several years later, I put some open repository to share the idea to the world.

There is one script to fetching the programming and searching for where certain programs appear on their grid, and another script that uses FFMEG to fetch the video, saving it locally, where I can watch on TV.

If you are also interested, here is the README.md from the repository from my NHK scripts

If you never really watched anything from NHK World Japan English, there is immediately two programs that deserve all the attention from a "Japanophile" (to use a term from Peter Barakan's program - Japanology)

japanology-barakan.png document-72.png

nhk-downloader

Tools for browsing and recording NHK World programming. Reverse-engineered from their website.

Scripts

list-programming-v3.rb — Browse the Progrmming Grid

Fetches NHK World's programme schedule and prints it in local time.

Usage:

list-programming-v3.rb [days] [search_string]

Arguments:

  • days — number of days to fetch, starting today (default: 1)
  • search_string — optional case-insensitive filter on programme title; when provided, also prints full programme details (description, IDs, etc.)

Examples:

# Show today's full schedule
ruby list-programming-v3.rb

# Show 3 days of programming
ruby list-programming-v3.rb 3

# Find all airings of "Japanology" in the next 7 days
ruby list-programming-v3.rb 7 japanology

Output: one line per programme — local start/end time, duration in minutes, title. With a search string, matching entries also get full JSON details.

================================================================================
Date: Thursday, May 28, 2026
URL: https://masterpl.hls.nhkworld.jp/epg/w/20260528.json
================================================================================
From: Thu 05/28/26 04:30 End: Thu 05/28/26 04:58 (28 minutes)     Japanology Plus

--- Program Details ---
{
  "seriesId": "2032",
  "airingId": "335",
  "title": "Japanology Plus",
  "episodeTitle": "Stephen Turner",
  "description": "Stephen Turner, from the UK, loves Japanese trains so much that his passion became his job. We join him on a trip through Chiba Prefecture and explore the appeal of Japan's regional railways.",
  "link": "https://www3.nhk.or.jp/nhkworld/en/shows/japanologyplus/",
  "thumbnail": "https://www3.nhk.or.jp/nhkworld/en/shows/japanologyplus/images/wide_l_43QOjgTfTlBBiZB0CwWlCON0BOF9JADSyGFTAG3A.jpg",
  "firstShow": 1,
  "startTime": "2026-05-28T11:30:00+09:00",
  "endTime": "2026-05-28T11:58:00+09:00",
  "endTimeReal": "2026-05-28T11:58:00+09:00",
  "jstrm": 1,
  "wstrm": 1,
  "extractProgram": 0,
  "episodeId": "203233520260528001",
  "playURL": "https://masterpl.hls.nhkworld.jp/hls/w/203233520260528001/master.m3u8",
  "vodStartTime": "2026-05-28T11:58:00+09:00",
  "vodEndTime": "2026-05-07T23:59:00+09:00",
  "episodeThumbnailURL": "https://www3.nhk.or.jp/nhkworld/en/shows/2032335/images/wide_l_nJShQZL4WJxnRzhmve7C4CmJ5hZFAykSp3XvevAo.jpg",
  "episodeLink": "https://www3.nhk.or.jp/nhkworld/en/shows/2032335/",
  "vodFlag": 1,
  "analyticsSimul": "[nhkworld]simul;Japanology Plus_Stephen Turner;w01,001;2032-335-2026;2026-05-28T11:30:00+09:00",
  "analyticsVod": "[nhkworld]vod;Japanology Plus_Stephen Turner;en,001;2032-335-2026;2026-05-28T11:30:00+09:00",
  "radioNotice": "",
  "genres": "8",
  "subGenres": "4"
}
--- End Details ---

Dependencies: Ruby standard library only (net/https, json, time, date)


capture-rundeck — Record a programme

Captures a live NHK World live stream to disk. Designed to be triggered by Rundeck (or any scheduler) shortly before a programme airs.

nhk-programming.png

Usage:

./capture-rundeck <program_token> <duration_minutes>

Arguments:

  • program_token — case-insensitive substring of the programme title (e.g. japanology, document-72-hours)
  • duration_minutes — how many minutes to record

Example:

./capture-rundeck japanology 30

What it does:

  1. Fetches today's and tomorrow's programming guide in JSON (JST dates, since NHK runs on Japan time)
  2. Searches for a matching programme starting within a window of max(5, duration/2) minutes from now — filters out INFO slots and fillers under 3 minutes
  3. Skips capture if the episode already exists on disk (duplicate check)
  4. Waits until 1 minute before the programme's scheduled start time
  5. Runs ffmpeg to capture the live stream for the requested duration, with retry logic (keeps retrying until 2 minutes past programme start)
  6. Creates a Kodi/Jellyfin-compatible .nfo sidecar file with title, episode, description, season, aired date, and thumbnail URL
  7. Downloads the episode thumbnail
  8. Moves video + NFO + thumbnail into a per-show subdirectory under the final destination
  9. Sends a Zabbix monitoring event (success or failure)

Output paths (hardcoded — edit the script to change):

  • Temp staging: /location/_NEW_DOWNLOADS/captured_videos/
  • Final library: /location/series_active/<Show Name>/

File naming:

<Title>-<Episode>-<DD-MM-YYYY>-<HH>.mp4
<Title>-<Episode>-<DD-MM-YYYY>-<HH>.nfo
<Title>-<Episode>-<DD-MM-YYYY>-<HH>-thumb.jpg

Dependencies: bash, curl, jq, ffmpeg, zabbix_sender

Zabbix: configured at the top of the script — edit ZBX_SRV, ZBX_HOST, and ZBX_PSK to match your environment. Disable by removing the send_zabbix_notification calls if not needed.


Reverse-Engineered Endpoint

Both scripts hit an undocumented NHK World endpoint scraped from their website:

https://masterpl.hls.nhkworld.jp/epg/w/YYYYMMDD.json

Dates are in JST. The JSON contains programme metadata including title, startTime, endTime, seriesId, airingId, playURL, description, and thumbnail URLs.