Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

real-user-agent

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

real-user-agent

get a real user-agent string sourced from top 10 current

  • 2.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
increased by200%
Maintainers
1
Weekly downloads
 
Created
Source

real-user-agent

Will the real user agent please stand up?

License: ISC

Get an up-to-date user-agent string, sourced from the most common user agents. To avoid each use of this module hammering the source, the data is now self-hosted in this repository, available via cdn. A simple local cache, invalidated every 2 hours, prevents extra requests. A data cap is implemented in the request. The local ua.json is used as a fallback in case the data is corrupt or host is unreachable.

const userAgent = require('real-user-agent');

// most common user-agent string
const ua = await userAgent();

// array of top 10 most common user-agent strings
const topTen = await userAgent.all();

// round robin top 10 most common user-agents
const randomUA = await userAgent.cycle();
const anotherUA = await userAgent.cycle();

// 5th most common user-agent
const fifth = await userAgent.cycle(4);

// random user-agent
const randomUA = await userAgent.cycle(Math.random());
const request = require('request');
const userAgent = require('real-user-agent');
request({
  url: 'https://api.github.com/repos/fijimunkii/real-user-agent',
  headers: {
    'user-agent': await userAgent()
  }
});

Authors

fijimunkii

License

This project is licensed under the ISC License - see the LICENSE file for details.

Keywords

FAQs

Package last updated on 05 Jun 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc