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

useragentsdata

v1.0.40

Published

This library contains `useragents.json` and small JS library to pick random useragents by pure randomity or by UA Popularity.

Downloads

118

Readme

UserAgents

This library contains useragents.json and small JS library to pick random useragents by pure randomity or by UA Popularity.

Installation

npm --save i useragentsdata 

Use Data in your own app

this is raw access to useragents, so you can process it with your own functions

var { useragents } = require('useragentsdata')
console.log(useragents)

picking a random Useragent

returns an agent object

var { randomUseragent } = require('useragentsdata')
console.log(`Random useragent by popularity:`,randomUseragent(true))
console.log(`Random useragent by randomity:`,randomUseragent(false))

Taking Useragent by BrowserFamily or/and OsFamily

the osFamily is optional

var { UseragentByFamily } = require('useragentsdata')
console.log(`Random Chrome UserAgent on a Mac OS:`,UseragentByFamily('chrome','Mac OS X'))

BrowserFamilies

var { UseragentBrowserFamilies } = require('useragentsdata')
console.log(`Browser Families:\n`,UseragentBrowserFamilies())

returns

 [ 'Chrome',
  'Firefox',
  'QQ Browser',
  'Other',
  'Yandex Browser',
  'Coc Coc',
  'Iron',
  'Firefox Mobile',
  'Opera',
  'Mobile Safari',
  'UC Browser',
  'Chromium',
  'Vivaldi',
  'Chrome Mobile',
  'Dragon',
  'Android',
  'Mobile Safari UI/WKWebView',
  'Edge',
  'Safari',
  'IE',
  'Baiduspider',
  'Nokia OSS Browser',
  'Mail.ru Chromium Browser',
  'Chrome Mobile WebView',
  'Chrome Mobile iOS' ]

Why ?

Sometimes one might need up2date and real Useragents for different projects and need to spoof Useragent. This library is designed for that purphose. I will try to update this library frequently. The useragents.json is the value of this repository since this data will be kept recent. Imagine Mozilla releases new version, you would need to update all your libraries too with most recent version just to look legitime

Background

These useragents are from real webvisitors and are anonimized. A typical UA data looks like:

{
      "popularity": 53,
      "agent": {
        "family": "Chrome",
        "major": "69",
        "minor": "0",
        "patch": "3497",
        "device": {
          "family": "Other",
          "major": "0",
          "minor": "0",
          "patch": "0"
        },
        "os": {
          "family": "Windows",
          "major": "8",
          "minor": "0",
          "patch": "0"
        }
      },
      "popularityRate": 0.0007017353385310296
    }

The agent,os,device properties are prepared by using https://github.com/3rd-Eden/useragent library. popularity is the number of times we have seen this UA. In this example this UA was seen 53 times among whole logging-period and the popularityRate is the % amount from all other UserAgents

This data might grow during the time but mathematically this data should be equal to browser market share because it is taken from sites with a lot of traffic.