npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

pod-ident

v1.0.5

Published

Podcast Client Detector without the clutter

Downloads

4

Readme

PodIdent - Podcast Client Detector without the clutter

Rationale

Focus

There are plenty of libraries that can parse and detect user agents in a generic way.

PodIdent takes a different approach here: it puts a lot of effort into getting the most used Podcast clients right, leaving the job of detecting browsers and more obscure devices to generic user agent detecting libraries.

Simplicity

Version numbers might be interesting for some use cases, but are not relevant at all to podcasters - podcasters want to know where their listeners are, and what platforms / clients work the best.

There is a great deal of confusion about what is a device, an operating system or a platform in general. To keep things simple, PodIdent uses platform as a generic term to describe the place where software runs. It can be an iPhone (device), iOS (operating system) or even just an "Apple device" (category).

PodIdent has no production dependencies. Keep it simple, and all that.

Preciseness

User agents are known to be confusing and difficult to understand. Most vendors don't document their user agents explicitly, and most of the detection rules are created by trying and collecting information from other sources.

This is why PodIdent tries to be always as precise as possible (if it knows that a client runs on an iPad, it will return platform: 'iPad', instead of a generic iOS.

Performance, memory usage

The detection rules always try to match substrings first, before using full-fledged regular expressions. This should make detection a lot faster. Also, since there are not even 100 podcast clients out there, there is no need to support a billion different browsers and devices.

Installation

npm install pod-ident

Usage

const detector = require('pod-ident')
const userAgent = 'AppleCoreMedia/1.0.0.10B500 (iPod; U; CPU OS 6_1_6 like Mac OS X; en_gb)'

const result = detector.detect(userAgent)
console.log(result)
=> {
  app: 'Apple Podcasts',
  platform: 'iPod',
  userAgent: 'AppleCoreMedia/1.0.0.10B500 (iPod; U; CPU OS 6_1_6 like Mac OS X; en_gb)'
}

Development & contributing

Feel free to run the tests with npm test. The detection rules are found as a yaml file under lib/detectionRules.yml.

Please, only edit this file, and afterwards run npm run parseRules in order to generate both the detection rules as a js file for production usage, and the complete rules with their corresponding test cases for testing.

Future implementations

It would be nice to have the following features in future versions:

  • bot & crawler detection (instead of having to use a generic user agent parser)
  • adding custom detection rules (this can be achieved today by pushing rules into the rules array, but there should be a better way)