NHK Program Guide: Programs, Search
NHK Program Guide: Programs, Search
Searches the program guide of the specified area channel and date. You can filter by keywords, program genre or time range. The keyword search is applied to the string that combines the program title, subtitle, content, and performers.
Configs
  • A: Set API Key *#{EL}
  • B1: Set Area ID (Broadcast Sta) (eg Tokyo: “130”, Kyoto: “260”) *#{EL}
  • B2: Set Service ID (Channel) (eg General: “g1”, all tv: “tv”) *#{EL}
  • B3: Set Date of Program Guide (starting with “YYYY-MM-DD”) *#{EL}
  • C1: Set Keywords filter in CSV (eg “DX,Transformation”)#{EL}
  • C2: Set Genre filter (eg News: “0000”)#{EL}
  • C3: Set Begin of StartTimeFilter (after “YYYY-MM-DD HH:MM”)#{EL}
  • C4: Set End of StartTimeFilter (before “YYYY-MM-DD HH:MM”)#{EL}
  • D1: Select the STRING type Data that stores the Search Result TSV (update)
  • D2: Select the STRING type Data that stores the Raw JSON for all Programs (update)
  • E0: Select the STRING type Data that store the ProgramID of the first program (update)
  • E1: Select the STRING type Data that stores the Service of the first program (update)
  • E2: Select the DATETIME type Data that stores the Start Time of the first program (update)
  • E3: Select the DATETIME type Data that stores the End Time of the first program (update)
  • E4: Select the STRING type Data that stores the Title of the first program (update)
  • E5: Select the STRING type Data that stores the Subtitle of the first program (update)
  • E6: Select the STRING type Data that stores the Content of the first program (update)
  • E7: Select the STRING type Data that stores the Actors of the first program (update)
Script (click to open)
// GraalJS Script (engine type: 2)

//////// START "main()" /////////////////////////////////////////////////////////////////
main();
function main(){ 

//// == Config Retrieving / 工程コンフィグの参照 ==
const strApiKey             = configs.get( "StrConfA" );  // required
  if( strApiKey           === "" ){
    throw new Error( "\n AutomatedTask ConfigError:" +
                     " Config {A API Key} is empty \n" );
  }
const strAreaId             = configs.get( "StrConfB1" ); // required
  if( strAreaId           === "" ){
    throw new Error( "\n AutomatedTask ConfigError:" +
                     " Config {B Area ID} is empty \n" );
  }
const strServiceId          = configs.get( "StrConfB2" ); // required
  if( strServiceId        === "" ){
    throw new Error( "\n AutomatedTask ConfigError:" +
                     " Config {B Service ID} is empty \n" );
  }
const strGuideDateTail      = configs.get( "StrConfB3" );  // required
  if( strGuideDateTail    === "" ){
    throw new Error( "\n AutomatedTask ConfigError:" +
                     " Config {B Guide Date} is empty \n" );
  }
  const strGuideDate        = strGuideDateTail.slice(0, 10); // (formatted)
const strFilterKeywords     = configs.get( "StrConfC1" );
  const arrFilterKeywords   = strFilterKeywords.split(",");
const strFilterGenre        = configs.get( "StrConfC2" );
const strFilterTimeBegin    = configs.get( "StrConfC3" );
const strFilterTimeEnd      = configs.get( "StrConfC4" );
const strPocketListTsv      = configs.getObject( "SelectConfD1" );
const strPocketRawJson      = configs.getObject( "SelectConfD2" );
const strPocketFirstId      = configs.getObject( "SelectConfE0" );
const strPocketFirstService = configs.getObject( "SelectConfE1" );
const timePocketFirstStart  = configs.getObject( "SelectConfE2" );
const timePocketFirstEnd    = configs.getObject( "SelectConfE3" );
const strPocketFirstTitle   = configs.getObject( "SelectConfE4" );
const strPocketFirstSub     = configs.getObject( "SelectConfE5" );
const strPocketFirstContent = configs.getObject( "SelectConfE6" );
const strPocketFirstAct     = configs.getObject( "SelectConfE7" );


//// == Data Retrieving / ワークフローデータの参照 ==
// (Nothing. Retrieved via Expression Language in Config Retrieving)


//// == Calculating / 演算 ==

/// ▽放送地域、サービス(放送波)を指定することで、番組情報を取得
/// https://api-portal.nhk.or.jp/doc-list-v2-con
/// ▽放送地域、EPG番組ジャンル、日付を指定することで、番組情報を取得
/// https://api-portal.nhk.or.jp/doc-genre-v2-con

// request1, prepare
let getUri1  = "https://api.nhk.or.jp/v2/pg/list" +
               "/" + strAreaId +
               "/" + strServiceId +
               "/" + strGuideDate +
               ".json";
if( strFilterGenre !== "" ){
    getUri1  = "https://api.nhk.or.jp/v2/pg/genre" +
               "/" + strAreaId +
               "/" + strServiceId +
               "/" + strFilterGenre +
               "/" + strGuideDate +
               ".json";
}
let request1 = httpClient.begin(); // HttpRequestWrapper
    request1 = request1.queryParam( "key", strApiKey ); 
// request1, try
const response1     = request1.get( getUri1 ); // HttpResponseWrapper
engine.log( " AutomatedTask ApiRequest1 Start: " + getUri1 );
const response1Code = response1.getStatusCode() + "";
const response1Body = response1.getResponseAsString() + "";
engine.log( " AutomatedTask ApiResponse1 Status: " + response1Code );
if( response1Code !== "200"){
  throw new Error( "\n AutomatedTask UnexpectedResponseError: " +
                    response1Code + "\n" + response1Body + "\n" );
}
// response1, parse
// engine.log( response1Body ); // debug
/* response sample
{
  "list": {
    "g1": [
      {
        "id": "2021022206260",
        "event_id": "06260",
        "start_time": "2021-02-22T03:50:00+09:00",
        "end_time": "2021-02-22T04:32:00+09:00",
        "area": {
          "id": "260",
          "name": "京都"
        },
        "service": {
          "id": "g1",
          "name": "NHK総合1",
          "logo_s": {
            "url": "//www.nhk.or.jp/common/img/media/gtv-100x50.png",
            "width": "100",
            "height": "50"
          },
          "logo_m": {
            "url": "//www.nhk.or.jp/common/img/media/gtv-200x100.png",
            "width": "200",
            "height": "100"
          },
          "logo_l": {
            "url": "//www.nhk.or.jp/common/img/media/gtv-200x200.png",
            "width": "200",
            "height": "200"
          }
        },
        "title": "空からクルージング特別編「ヨーロッパの城と宮殿」",
        "subtitle": "世界各地の絶景の中を空からゆったりと旅をする紀行番組「空からクルージング」…",
        "content": "ヨーロッパ各地に残るたくさんの城や宮殿の美しい姿と、歴史の物語を紹介する。ス…",
        "act": "",
        "genres": [
          "1000"
        ]
      },
*/
const response1Obj = JSON.parse( response1Body );
engine.log( " AutomatedTask ApiResponse1 Services: " + Object.keys(response1Obj.list).toString() );

/// Store All in 2D-Array, Temporarily
let arrAllPrograms = [];
Object.keys(response1Obj.list).forEach(function( strService ) {
  engine.log( " AutomatedTask ApiResponse1 # of " + strService +
              ": " + response1Obj.list[strService].length );
  for( let i = 0; i < response1Obj.list[strService].length; i++ ){
    let tmp = [];
    tmp.push( strService );
    tmp.push( response1Obj.list[strService][i].id );
    tmp.push( response1Obj.list[strService][i].start_time ); // 2
    tmp.push( response1Obj.list[strService][i].end_time );
    tmp.push( response1Obj.list[strService][i].title );    // 4
    tmp.push( response1Obj.list[strService][i].subtitle ); // 5
    tmp.push( response1Obj.list[strService][i].content );  // 6
    tmp.push( response1Obj.list[strService][i].act );      // 7
    arrAllPrograms.push( tmp );
  }
});
engine.log( " AutomatedTask: # of Programs without filter: " + arrAllPrograms.length );

/// Filter by Keywords
let arrKeywordFilteredPrograms = arrAllPrograms.filter( function( arr ) {
  let boolMatch = false;
  if( strFilterKeywords === "" ){
    boolMatch = true;
  }else{
    for( let i = 0; i < arrFilterKeywords.length; i++ ){
      let regTmp = new RegExp( arrFilterKeywords[i] );
      for( let j = 4; j < 8; j++ ){
        if( regTmp.test( arr[j] ) ){
          engine.log( " AutomatedTask Matched: '" + arrFilterKeywords[i] + "' in: " + arr[j] );
          boolMatch = true;
          break;
        }
      }
      if( boolMatch ){ break; }
    }
  }
  if( boolMatch ){ return arr; }
});
engine.log( " AutomatedTask: # of Programs Keyword Filtered: " + arrKeywordFilteredPrograms.length );

/// Filter by Time
let dateFilterTimeBegin   = new Date();
let dateFilterTimeEnd     = new Date();
if( strFilterTimeBegin  !== "" ){
    dateFilterTimeBegin   = toJsDate( strFilterTimeBegin );
}
if( strFilterTimeEnd    !== "" ){
    dateFilterTimeEnd     = toJsDate( strFilterTimeEnd );
}
let arrTimeFilteredPrograms = arrKeywordFilteredPrograms.filter( function( arr ) {
  let boolMatch = false;
  let dateProgramStartTime = new Date( arr[2] );
  if( strFilterTimeBegin === "" && strFilterTimeEnd === "" ){
    boolMatch = true;
  }else if( strFilterTimeBegin !== "" && strFilterTimeEnd === "" ){
    if( dateFilterTimeBegin.getTime() <= dateProgramStartTime.getTime() ){
      boolMatch = true;
    }
  }else if( strFilterTimeBegin === "" && strFilterTimeEnd !== "" ){
    if( dateProgramStartTime.getTime() <= dateFilterTimeEnd.getTime() ){
      boolMatch = true;
    }
  }else if( strFilterTimeBegin !== "" && strFilterTimeEnd !== "" ){
    if( dateFilterTimeBegin.getTime() <= dateProgramStartTime.getTime() && 
        dateProgramStartTime.getTime() <= dateFilterTimeEnd.getTime() ){
      boolMatch = true;
    }
  }
  if( boolMatch ){ return arr; }
});
engine.log( " AutomatedTask: # of Programs StartTime Filtered: " + arrTimeFilteredPrograms.length );

/// Create TSV
let strListTsv = "";
for(   let i = 0; i < arrTimeFilteredPrograms.length; i++ ){
  for( let j = 0; j < arrTimeFilteredPrograms[i].length; j++ ){
    strListTsv     += arrTimeFilteredPrograms[i][j];
    if( j !== arrTimeFilteredPrograms[i].length - 1 ){
      strListTsv   += "\t";
    }
  }
  if( i !==   arrTimeFilteredPrograms.length - 1 ){
    strListTsv     += "\n";
  }
}


//// == Data Updating / ワークフローデータへの代入 ==
if( strPocketListTsv      !== null && arrTimeFilteredPrograms.length > 0 ){
  engine.setData( strPocketListTsv,      strListTsv );
}
if( strPocketRawJson      !== null ){
  if( response1Body.length > 999999 ){ // Maximum string size in Workflow Platform
    engine.setData( strPocketRawJson,      '{"Json String": "over 1,000,000 characters"}' );
  }else{
    engine.setData( strPocketRawJson,      response1Body );
  }
}
if( strPocketFirstId      !== null && arrTimeFilteredPrograms.length > 0 ){
  engine.setData( strPocketFirstId,      arrTimeFilteredPrograms[0][1] );
}
if( strPocketFirstService !== null && arrTimeFilteredPrograms.length > 0 ){
  if( arrTimeFilteredPrograms[0][0] === "g1" ){
    engine.setData( strPocketFirstService, "NHK総合1" );
  }else if( arrTimeFilteredPrograms[0][0] === "g2" ){
    engine.setData( strPocketFirstService, "NHK総合2" );
  }else if( arrTimeFilteredPrograms[0][0] === "e1" ){
    engine.setData( strPocketFirstService, "NHKEテレ1" );
  }else if( arrTimeFilteredPrograms[0][0] === "e2" ){
    engine.setData( strPocketFirstService, "NHKEテレ2" );
  }else if( arrTimeFilteredPrograms[0][0] === "e3" ){
    engine.setData( strPocketFirstService, "NHKEテレ3" );
  }else if( arrTimeFilteredPrograms[0][0] === "e4" ){
    engine.setData( strPocketFirstService, "NHKワンセグ2" );
  }else if( arrTimeFilteredPrograms[0][0] === "s1" ){
    engine.setData( strPocketFirstService, "NHKBS1" );
  }else if( arrTimeFilteredPrograms[0][0] === "s2" ){
    engine.setData( strPocketFirstService, "NHKBS1(102ch)" );
  }else if( arrTimeFilteredPrograms[0][0] === "s3" ){
    engine.setData( strPocketFirstService, "NHKBSプレミアム" );
  }else if( arrTimeFilteredPrograms[0][0] === "s4" ){
    engine.setData( strPocketFirstService, "NHKBSプレミアム(104ch)" );
  }else if( arrTimeFilteredPrograms[0][0] === "r1" ){
    engine.setData( strPocketFirstService, "NHKラジオ第1" );
  }else if( arrTimeFilteredPrograms[0][0] === "r2" ){
    engine.setData( strPocketFirstService, "NHKラジオ第2" );
  }else if( arrTimeFilteredPrograms[0][0] === "r3" ){
    engine.setData( strPocketFirstService, "NHKFM" );
  }else if( arrTimeFilteredPrograms[0][0] === "n1" ){
    engine.setData( strPocketFirstService, "NHKネットラジオ第1" );
  }else if( arrTimeFilteredPrograms[0][0] === "n2" ){
    engine.setData( strPocketFirstService, "NHKネットラジオ第2" );
  }else if( arrTimeFilteredPrograms[0][0] === "n3" ){
    engine.setData( strPocketFirstService, "NHKネットラジオFM" );
  }
}
if( timePocketFirstStart  !== null && arrTimeFilteredPrograms.length > 0 ){
  let dateFirstStart = new Date( arrTimeFilteredPrograms[0][2] );
  engine.setData( timePocketFirstStart,  new java.sql.Timestamp( dateFirstStart.getTime() ) );
}
if( timePocketFirstEnd    !== null && arrTimeFilteredPrograms.length > 0 ){
  let dateFirstEnd   = new Date( arrTimeFilteredPrograms[0][3] );
  engine.setData( timePocketFirstEnd,    new java.sql.Timestamp( dateFirstEnd.getTime() ) );
}
if( strPocketFirstTitle   !== null && arrTimeFilteredPrograms.length > 0 ){
  engine.setData( strPocketFirstTitle,   arrTimeFilteredPrograms[0][4]  );
}
if( strPocketFirstSub     !== null && arrTimeFilteredPrograms.length > 0 ){
  engine.setData( strPocketFirstSub,     arrTimeFilteredPrograms[0][5] );
}
if( strPocketFirstContent !== null && arrTimeFilteredPrograms.length > 0 ){
  engine.setData( strPocketFirstContent, arrTimeFilteredPrograms[0][6] );
}
if( strPocketFirstAct     !== null && arrTimeFilteredPrograms.length > 0 ){
  engine.setData( strPocketFirstAct,     arrTimeFilteredPrograms[0][7] );
}

} //////// END "main()" /////////////////////////////////////////////////////////////////



function toJsDate( bpmsDateOrDatetimeStr ){
  // BPMS Date:     "2020-04-01"  (subtype "Y/M" "M/D" "Y", not supported)
  // BPMS Datetime: "2020-04-01 23:59"
  let year       = 0;
  let monthIndex = 0;
  let day        = 0;
  let hours      = 0;
  let minutes    = 0;

  //  The ECMA/JavaScript Date object has a large number of methods.
  // "Date.parse" is danger (strongly discouraged)
  // - new Date("2014-11-10") // Mon Nov 10 2014 09:00:00 GMT+0900 (JST)
  // - new Date(2014, 10, 10) // Mon Nov 10 2014 00:00:00 GMT+0900 (JST)
  let arrDatetime = bpmsDateOrDatetimeStr.split(" ");
  if( arrDatetime.length === 1 ){
    let arrDateParts = arrDatetime[0].split("-");
    year       = parseInt(arrDateParts[0], 10);
    monthIndex = parseInt(arrDateParts[1], 10) - 1;
    day        = parseInt(arrDateParts[2], 10);
  }
  if( arrDatetime.length === 2 ){
    let arrDateParts = arrDatetime[0].split("-");
    let arrTimeParts = arrDatetime[1].split(":");
    year       = parseInt(arrDateParts[0], 10);
    monthIndex = parseInt(arrDateParts[1], 10) - 1;
    day        = parseInt(arrDateParts[2], 10);
    hours      = parseInt(arrTimeParts[0], 10);
    minutes    = parseInt(arrTimeParts[1], 10);
  }
  return new Date( year, monthIndex, day, hours, minutes );
}



/*
Notes:
- Detects exposure to NHK broadcast automatically. (Industry trends, regions info, competitors,,)
    - If the search result is zero, nothing is updated. It does not cause a runtime error.
    - "Notification to stakeholders" triggered by information detection, etc.
- You can get the broadcast summary of your favorite program with filtering by channel and time.
- Searchable up to 8 days in advance.
    - Specify with a string starting with "YYYY-MM-DD". ("Datetime type data" is also acceptable)
    - To config dynamically "process start date" and "21:00 the day after the process start date"
        - #{#format(processInstanceStartDatetime,'yyyy-MM-dd')}
        - #{#format(processInstanceStartDatetime.addDays(1), 'yyyy-MM-dd 21:00')}
        - https://questetra.zendesk.com/hc/en-us/articles/360024292872-R2272
- Search result list (TSV)
    - Program ID, Service Name, Start time, End time, Program title, subtitle, content, performers
    - Time format: String of "ISO 8601 Extended Format" (YYYY-MM-DDThh:mm:ss+09:00)

Notes-ja:
- NHKへの露出を自動検知します。(業界トレンド語、地元地域、競合他社など)
    - 検索結果がゼロの場合、何も更新されません。処理エラーにもなりません。
    - 情報検知をトリガーにした「ステークホルダーへの情報発信業務」など
- チャンネルと開始時刻等でフィルタすれば、お気に入りの番組の放送概要を取得することが可能です。
- 8日先までの日時が指定可能です。
    - "YYYY-MM-DD" で始まる文字列で指定します。("日時型データ" の参照でも構いません)
    - 動的に「プロセス開始日」や「プロセス開始日の翌日21時」をConfigセットしたい場合
        - #{#format(processInstanceStartDatetime, 'yyyy-MM-dd')}
        - #{#format(processInstanceStartDatetime.addDays(1), 'yyyy-MM-dd 21:00')}
        - https://questetra.zendesk.com/hc/ja/articles/360024292872-R2272
- 検索結果リスト(TSV)
    - 番組ID、サービス名、開始時刻、終了時刻、番組タイトル、サブタイトル、内容、出演者
    - 時刻は "ISO 8601 拡張形式" の文字列(YYYY-MM-DDThh:mm:ss+09:00)
*/


/*
APPENDIX
- Create an API key on the "API Apps" page of your personal account beforehand.
    - https://api-portal.nhk.or.jp/my-apps/
- Program data is acquired via "Program List API" or "Program Genre API".
    - It is available free of charge. https://api-portal.nhk.or.jp/
- Area codes https://api-portal.nhk.or.jp/doc-request
    - 010: Sapporo, 011: Hakodate, 012: Asahikawa, 013: Obihiro, 014: Kushiro, 015: Kitami, 016: Muroran, 020: Aomori,
    - 030: Morioka, 040: Sendai, 050: Akita, 060: Yamagata, 070: Fukushima, 080: Mito, 090: Utsunomiya, 100: Maebashi,
    - 110: Saitama, 120: Chiba, 130: Tokyo, 140: Yokohama, 150: Niigata, 160: Toyama, 170: Kanazawa, 180: Fukui,
    - 190: Kofu, 200: Nagano, 210: Gifu, 220: Shizuoka, 230: Nagoya, 240: Tsu, 250: Otsu, 260: Kyoto,
    - 270: Osaka, 280: Kobe, 290: Nara, 300: Wakayama, 310: Tottori, 320: Matsue, 330: Okayama, 340: Hiroshima,
    - 350: Yamaguchi, 360: Tokushima, 370: Takamatsu, 380: Matsuyama, 390: Kochi, 400: Fukuoka, 401: Kitakyushu, 410: Saga,
    - 420: Nagasaki, 430: Kumamoto, 440: Oita, 450: Miyazaki, 460: Kagoshima, 470: Okinawa
- Channel codes (service)
    - g1: NHK General 1, g2: NHK General 2
    - e1: NHK Educational TV 1, e2: NHK Educational TV 2, e3: NHK Educational TV 3, e4: NHK OneSeg 2
    - s1: NHKBS1, s2: NHKBS1 (102ch), s3: NHKBS Premium, s4: NHKBS Premium (104ch)
    - r1: NHK Radio 1st, r2: NHK Radio 2nd, r3: NHKFM
    - n1: NHK Net Radio No. 1, n2: NHK Net Radio No. 2, n3: NHK Net Radio FM
    - tv: all TV, radio: all radio, netradio: all net radio
    - When searched multiple channels at once with "tv" etc., the same program will be hit multiple times.
- Genre codes
    - 0000: News (Comprehensive)
    - 0002: News (Special)
    - 0003: News (Politics / Diet)
    - 0005: News (Overseas / International)
    - 0009: News (Local / Regional)
    - 0100: Sports (Sports News)
    - 0101: Sports (Baseball)
    - 0102: Sports (Soccer)
    - 0102: Sports (Olympic Games / International Games)
    - 0203: Information (Health / Medical)
    - 0205: Information (Gourmet / Cooking)
    - 0300: Drama (Domestic drama)
    - 0301: Drama (Overseas drama)
    - 0302: Drama (Historical drama)
    - 0402: Music (Classical / Opera)
    - 0409: Music (Nursery Rhymes / Kids)
    - 0500: Variety (Quiz)
    - 0502: Variety (Talk)
    - 0504: Variety (Music)
    - 0600: Movie (Western)
    - 0601: Movie (Japanese)
    - 0602: Movie (Anime)
    - 0700: Anime (Domestic)
    - 0800: Documentary / Culture (Society / Current Affairs)
    - 0801: Documentary / Culture (History / Travel)
    - 0803: Documentary / Culture (Space / Science / Medicine)
    - 0807: Documentary / Culture (Documentary in general)
    - 0903: Theater / Performance (Rakugo / Performance)
    - 1000: Hobbies / Education (Travel / Fishing / Outdoor)
    - 1007: Hobbies / Education (Conversation / Language)
    - 1008: Hobbies / Education (Infants / Elementary School Students)
    - 1010: Hobbies / Education (University students / Examinations)
    - 1100: Welfare (Elderly)
    - 1104: Welfare (Sign language)

APPENDIX-ja
- ご利用アカウントの "My Apps" ページにて、あらかじめ API Key を生成しておく必要があります。
    - https://api-portal.nhk.or.jp/my-apps/
- 番組データは "Program List API" もしくは "Program Genre API" 経由で取得されます。
    - 無料で利用可能です。 https://api-portal.nhk.or.jp/
- 地域 https://api-portal.nhk.or.jp/doc-request
    - 010:札幌, 011:函館, 012:旭川, 013:帯広, 014:釧路, 015:北見, 016:室蘭, 020:青森,
    - 030:盛岡, 040:仙台, 050:秋田, 060:山形, 070:福島, 080:水戸, 090:宇都宮, 100:前橋,
    - 110:さいたま, 120:千葉, 130:東京, 140:横浜, 150:新潟, 160:富山, 170:金沢, 180:福井,
    - 190:甲府, 200:長野, 210:岐阜, 220:静岡, 230:名古屋, 240:津, 250:大津, 260:京都,
    - 270:大阪, 280:神戸, 290:奈良, 300:和歌山, 310:鳥取, 320:松江, 330:岡山, 340:広島,
    - 350:山口, 360:徳島, 370:高松, 380:松山, 390:高知, 400:福岡, 401:北九州, 410:佐賀,
    - 420:長崎, 430:熊本, 440:大分, 450:宮崎, 460:鹿児島, 470:沖縄
- チャンネル(サービス)
    - g1:NHK総合1, g2:NHK総合2
    - e1:NHKEテレ1, e2:NHKEテレ2, e3:NHKEテレ3, e4:NHKワンセグ2
    - s1:NHKBS1, s2:(102ch), s3:NHKBSプレミアム, s4:(104ch)
    - r1:NHKラジオ第1, r2:NHKラジオ第2, r3:NHKFM
    - n1:NHKネットラジオ第1, n2:NHKネットラジオ第2, n3:NHKネットラジオFM
    - tv:テレビ全て, radio:ラジオ全て, netradio:ネットラジオ全て
    - "tv" 等で複数チャンネルを一括検索した場合、多くの場合、同じ番組が複数回ヒットします。
- ジャンル
    - 0000:ニュース/報道(定時・総合)
    - 0002:ニュース/報道(特集・ドキュメント)
    - 0003:ニュース/報道(政治・国会)
    - 0005:ニュース/報道(海外・国際)
    - 0009:ニュース/報道(ローカル・地域)
    - 0100:スポーツ(スポーツニュース)
    - 0101:スポーツ(野球)
    - 0102:スポーツ(サッカー)
    - 0102:スポーツ(オリンピック・国際大会)
    - 0203:情報/ワイドショー(健康・医療)
    - 0205:情報/ワイドショー(グルメ・料理)
    - 0300:ドラマ(国内ドラマ)
    - 0301:ドラマ(海外ドラマ)
    - 0302:ドラマ(時代劇)
    - 0402:音楽(クラシック・オペラ)
    - 0409:音楽(童謡・キッズ)
    - 0500:バラエティ(クイズ)
    - 0502:バラエティ(トークバラエティ)
    - 0504:バラエティ(音楽バラエティ)
    - 0600:映画(洋画)
    - 0601:映画(邦画)
    - 0602:映画(アニメ)
    - 0700:アニメ/特撮(国内アニメ)
    - 0800:ドキュメンタリー/教養(社会・時事)
    - 0801:ドキュメンタリー/教養(歴史・紀行)
    - 0803:ドキュメンタリー/教養(宇宙・科学・医学)
    - 0807:ドキュメンタリー/教養(ドキュメンタリー全般)
    - 0903:劇場/公演(落語・演芸)
    - 1000:趣味/教育(旅・釣り・アウトドア)
    - 1007:趣味/教育(会話・語学)
    - 1008:趣味/教育(幼児・小学生)
    - 1010:趣味/教育(大学生・受験)
    - 1100:福祉(高齢者)
    - 1104:福祉(手話)
*/


Download

2021-02-23 (C) Questetra, Inc. (MIT License)
https://support.questetra.com/addons/nhk-program-guide-programs-search/
The Addon-import feature is available with Professional edition.

Notes

  • Detects exposure to NHK broadcast automatically (industry trends, regions info, competitors).
    • If the search result is zero, nothing is updated. It does not cause a runtime error.
    • Stakeholder notification is triggered by information detection.
  • You can get the broadcast summary of your favourite program filtering by channel and time.
  • Searchable up to 8 days in advance.
    • The date can start with “YYYY-MM-DD” (Datetime type data is also acceptable).
    • If you want to dynamically set the process start date or for 21:00 the day after the process start date:
  • Search result list (TSV)
    • Program ID, Service Name, Start time, End time, Program title, subtitle, content, performers
    • Time format: String of “ISO 8601 Extended Format” (YYYY-MM-DDThh:mm:ss+09:00)

Capture

Searches the program guide of the specified area channel and date. Keywords filter, Program genre filter or time range filter can be set. The keyword search is applied to the string that combines the program title, subtitle, content, and performers.

Appendix

  • Create an API key on the “API Apps” page of your personal account beforehand.
  • Program data is acquired via “Program List API” or “Program Genre API”.
  • Area codes https://api-portal.nhk.or.jp/doc-request
    • 010: Sapporo, 011: Hakodate, 012: Asahikawa, 013: Obihiro, 014: Kushiro, 015: Kitami, 016: Muroran, 020: Aomori,
    • 030: Morioka, 040: Sendai, 050: Akita, 060: Yamagata, 070: Fukushima, 080: Mito, 090: Utsunomiya, 100: Maebashi,
    • 110: Saitama, 120: Chiba, 130: Tokyo, 140: Yokohama, 150: Niigata, 160: Toyama, 170: Kanazawa, 180: Fukui,
    • 190: Kofu, 200: Nagano, 210: Gifu, 220: Shizuoka, 230: Nagoya, 240: Tsu, 250: Otsu, 260: Kyoto,
    • 270: Osaka, 280: Kobe, 290: Nara, 300: Wakayama, 310: Tottori, 320: Matsue, 330: Okayama, 340: Hiroshima,
    • 350: Yamaguchi, 360: Tokushima, 370: Takamatsu, 380: Matsuyama, 390: Kochi, 400: Fukuoka, 401: Kitakyushu, 410: Saga,
    • 420: Nagasaki, 430: Kumamoto, 440: Oita, 450: Miyazaki, 460: Kagoshima, 470: Okinawa
  • Channel codes (service)
    • g1: NHK General 1, g2: NHK General 2
    • e1: NHK Educational TV 1, e2: NHK Educational TV 2, e3: NHK Educational TV 3, e4: NHK OneSeg 2
    • s1: NHKBS1, s2: NHKBS1 (102ch), s3: NHKBS Premium, s4: NHKBS Premium (104ch)
    • r1: NHK Radio 1st, r2: NHK Radio 2nd, r3: NHKFM
    • n1: NHK Net Radio No. 1, n2: NHK Net Radio No. 2, n3: NHK Net Radio FM
    • tv: all TV, radio: all radio, netradio: all net radio
    • When searched multiple channels at once with “tv” etc., the same program will be hit multiple times.
  • Genre codes
    • 0000: News (Comprehensive)
    • 0002: News (Special)
    • 0003: News (Politics / Diet)
    • 0005: News (Overseas / International)
    • 0009: News (Local / Regional)
    • 0100: Sports (Sports News)
    • 0101: Sports (Baseball)
    • 0102: Sports (Soccer)
    • 0102: Sports (Olympic Games / International Games)
    • 0203: Information (Health / Medical)
    • 0205: Information (Gourmet / Cooking)
    • 0300: Drama (Domestic drama)
    • 0301: Drama (Overseas drama)
    • 0302: Drama (Historical drama)
    • 0402: Music (Classical / Opera)
    • 0409: Music (Nursery Rhymes / Kids)
    • 0500: Variety (Quiz)
    • 0502: Variety (Talk)
    • 0504: Variety (Music)
    • 0600: Movie (Western)
    • 0601: Movie (Japanese)
    • 0602: Movie (Anime)
    • 0700: Anime (Domestic)
    • 0800: Documentary / Culture (Society / Current Affairs)
    • 0801: Documentary / Culture (History / Travel)
    • 0803: Documentary / Culture (Space / Science / Medicine)
    • 0807: Documentary / Culture (Documentary in general)
    • 0903: Theater / Performance (Rakugo / Performance)
    • 1000: Hobbies / Education (Travel / Fishing / Outdoor)
    • 1007: Hobbies / Education (Conversation / Language)
    • 1008: Hobbies / Education (Infants / Elementary School Students)
    • 1010: Hobbies / Education (University students / Examinations)
    • 1100: Welfare (Elderly)
    • 1104: Welfare (Sign language)

See also

1 thought on “NHK Program Guide #Programs: Search”

  1. Pingback: NHK Program Search – Questetra Support

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: