node package manager



Extracts the programcard URN from a url


npm install denmark-dr-programcard


const programcard = require('denmark-dr-programcard');

Given a popup url, this module will extract the programcard URN. This is an id you can use to get more information about the specific program.

First step is usually to make a REST request to${programcard}. See for the full documentation.

const href = '';
programcard(href, function (err, urn) {
  if (err) throw err;
  assert(urn === 'urn:dr:mu:programcard:55f8aaa7a11f9f17c87b7254');

Source provides a poorly documented but public API at . ProTip: there is a version 1.3 of the API, but you will be redirected to version 1.2. Unless you explicitly set it in the URL.

Much of this API is based on specific IDs, and these IDs are hard to obtain form a friendly url. But in the HTML source code of the popup url (and possibly other urls), there is a <script> tag that sets a window.DR object. From this window.DR object programcard URN can be extracted. Using the programcard URN many of the other related IDs can be obtained.