Skip to content

Latest commit

 

History

History
57 lines (42 loc) · 1.46 KB

README.md

File metadata and controls

57 lines (42 loc) · 1.46 KB

PRX Podcast User-Agent Parser

license npm npm

Description

Basic User-Agent string parser that includes some basic podcasting apps. This project is intended to help parse/group requests for analytics purposes, not for browser feature detection.

The included agents.lock.yml also includes name/type/os IDs, in case you want to normalize the strings in your database.

Install

Just npm install --save prx-podagent. It's that easy!

Usage

Async (recommended):

const podagent = require('prx-podagent');
podagent.parse('some-string', (err, agent) => {
  if (agent) {
    console.log('Match:', agent.name, agent.type, agent.os);
  } else {
    console.log('Did not match any known agents');
  }
});

Sync:

const podagent = require('prx-podagent');
let agent = podagent.parse('some-string');
if (agent) {
  console.log('Match:', agent.name, agent.type, agent.os);
} else {
  console.log('Did not match any known agents');
}

License

MIT License

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request