0.5.0 • Published 5 years ago

random-useragent v0.5.0

Weekly downloads
8,792
License
MIT
Repository
github
Last release
5 years ago

random-useragent

NPM version Build Status Code Climate Coverage Status Dependency Status devDependency Status

NPM

Description

Get a random user agent (with an optional filter to select from a specific set of user agents).

Getting Started

Install the module with: npm install random-useragent

const randomUseragent = require('random-useragent');
randomUseragent.getRandom(); // gets a random user agent string

Documentation

.getRandom(filter)

Get a random user agent string (optionally using a filter).

Example Result:

'Mozilla/5.0 (Windows NT 6.2; rv:20.0) Gecko/20121202 Firefox/20.0'

.getRandomData(filter)

Get a random user agent's parsed data (optionally using a filter).

Example Result:

{
	"folder": "/Browsers - Windows/Legacy Browsers",
	"description": "Firefox 20.0 (Win 8 32)",
	"userAgent": "Mozilla/5.0 (Windows NT 6.2; rv:20.0) Gecko/20121202 Firefox/20.0",
	"appCodename": "",
	"appName": "",
	"appVersion": "",
	"platform": "",
	"vendor": "",
	"vendorSub": "",
	"browserName": "Firefox",
	"browserMajor": "20",
	"browserVersion": "20.0",
	"deviceModel": "",
	"deviceType": "",
	"deviceVendor": "",
	"engineName": "Gecko",
	"engineVersion": "20.0",
	"osName": "Windows",
	"osVersion": "8",
	"cpuArchitecture": ""
}

.getAll(filter)

Get an array of all the user agent strings (optionally using a filter).

.getAllData(filter)

Get an array of all the parsed user agent data (optionally using a filter).

Examples

Get a random user agent string:

randomUseragent.getRandom();

Get a random Firefox user agent string:

randomUseragent.getRandom(function (ua) {
	return ua.browserName === 'Firefox';
});

Get a random user agent with a version >= 20:

randomUseragent.getRandom(function (ua) {
	return parseFloat(ua.browserVersion) >= 20;
});

Source Of User Agents

The collection of user agents is pulled from the large, regularly updated xml file provided by the author of User Agent Switcher, which is located here:

Links

License

Copyright (c) 2014 skratchdot
Licensed under the MIT license.

eos-bot-blockchainctripcrawlerticketscoopcheating-utilitieshltv-proxyim-crawler@infinitebrahmanuniverse/nolb-random-u@everything-registry/sub-chunk-2529hiru-news-apiwdwjstherepo90-repo-scrapervsdownvcoinwsvideo-extractor@dingyi222666/koishi-plugin-chathub@dingyi222666/koishi-plugin-chathub-bard-adapter@dingyi222666/koishi-plugin-chathub-claude2-adapter@dingyi222666/koishi-plugin-chathub-copilothub-adapter@dingyi222666/koishi-plugin-chathub-poe-adapter@deovan/rpa-puppeteer-utils@xyzendev/getcontact-jsjosh-fcakahoot.js-latestkahooteerkahoot-toolkitkahoot.js-apikinoapispeechifyapistargazerzsrtraintwitch-integritytgstat-scrappingtobvajuser-request@casper-js/core@castlelemongrab/parlance@browserstorm/runtime@acoustic-content-sdk/app@acoustic-content-sdk/bootstrap@acoustic-content-sdk/cli@acoustic-content-sdk/react-cli500px-api@acoustic-content-sdk/schematicszbmusicyandexzerogptunshortify@feizheng/next-random-ua@ibm-wch-sdk/rx-utils@fede14it/discord-video-stream@fuseble.inc/market@movieko/movie-api@muryllo/querobolsa-api@kazesolo/random-anime@jkap/themeparks@jomari-wp/linkedin-jobs-scraper@kimcore/hcs.js@imohuan/crawler@jswork/next-random-ua@ryzl/hltv@sofwar/hltv@specify_/mangascrapermovie-apiminic-serveminic99migration-pipelinemitsuku-ai-apin_music_seacholkj-clinyamaodpscraper-utilscrapy-cliscraparudyjsrollup-plugin-tinyimgnode-proxy-fetchnewgen-fcanextgen-fcanode-tradingviewpixelplacejspinokiodplaydl-music-extractorpoe-node-apipetgpt-plugin-poepullpoor-corereverso-apisneak-filegodlessggmsgoogle-dictionary-apihttp-privacy-jsic-portalgtc-jsgoods-crawlingharunahongkong-beach-waterqualityhongkong-tramshomebridge-defrohtml-pages-parser
0.5.0

5 years ago

0.4.0

5 years ago

0.3.1

9 years ago

0.3.0

9 years ago

0.2.1

9 years ago

0.2.0

9 years ago

0.1.1

10 years ago

0.1.0

11 years ago