tm-publication-mapping

Takes a url and returns the publication and platform of that url

Usage no npm install needed!

<script type="module">
  import tmPublicationMapping from 'https://cdn.skypack.dev/tm-publication-mapping';
</script>

README

Reach Publication Mapping

What?

This JS library will give you the functionality of getting platform, publication ID, channel, section, and article ID from a URL of an article belonging to Reach (Trinity Mirror).

Example Use

Providing you have installed this using npm install tm-publication-mapping, you can use the function like this:

const pubMap = require('tm-publication-mapping');

pubMap('https://www.mirror.co.uk/news/uk-news/woman-21-wakes-up-stiff-18960990')
>>>
{ platform: 'nationals',
  publicationId: 2,
  channel: 'news',
  section: 'uk-news',
  articleId: '18960990',
  names: ['Mirror'],
  url:  '.mirror.co.uk'
}

You can also use a name lookup to get info like this

const pubMap = require('tm-publication-mapping');

pubMap.nameLookUp('mirror')

{ platform: 'nationals',
  publicationId: 2,
  names: [ 'Mirror' ],
  url: '.mirror.co.uk' }

Contact

  • Maintainer: Jeff Downie (jeff.downie@trinitymirror.com)
  • Team: Data (data-team@trinitymirror.com)