Skip to content

denmark-io/denmark-dr-programcard

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#denmark-dr-programcard Build Status

Extracts the programcard URN from a dr.dk url

Installation

npm install denmark-dr-programcard

Documentation

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 http://www.dr.dk/mu-online/api/1.3/programcard/${programcard}. See http://www.dr.dk/mu-online/Help/1.3 for the full documentation.

const href = 'https://www.dr.dk/tv/se/detektor-tv/detektor-2015-09-24';
programcard(href, function (err, urn) {
  if (err) throw err;

  assert(urn === 'urn:dr:mu:programcard:55f8aaa7a11f9f17c87b7254');
});

Source

DR.dk provides a poorly documented but public API at http://www.dr.dk/mu-online/Help/1.3 . 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.

About

Extracts the programcard URN from a dr.dk url

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published