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 - npm Package Compare versions

Comparing version 1.0.4 to 2.0.0

sync.js

11

index.js

@@ -16,5 +16,5 @@ module.exports = () => all().then(d => d.shift());

const options = {
hostname: 'techblog.willshouse.com',
hostname: 'gist.githubusercontent.com',
port: 443,
path: '/2012/01/03/most-common-user-agents/',
path: '/fijimunkii/952acac988f2d25bef7e0284bc63c406/raw/ua.json',
method: 'GET'

@@ -35,8 +35,5 @@ };

}
// extract JSON
data = buffer.join('')
.replace(/^[\S\s]*JSON.*\[/, '[')
.replace(/\][\S\s]*$/, ']');
// extract data
data = JSON.parse(data).map(d => d.useragent);
data = buffer.join('');
data = JSON.parse(data);
// data integrity

@@ -43,0 +40,0 @@ data = data.filter(d => d.substr(0, 13) === 'Mozilla/5.0 (');

{
"name": "real-user-agent",
"version": "1.0.4",
"version": "2.0.0",
"description": "get a real user-agent string sourced from top 10 current",
"main": "index.js",
"scripts": {
"test": "node ./node_modules/.bin/tap test --jobs=10 --coverage-report=html --no-browser"
"test": "node ./node_modules/.bin/tap test --jobs=10 --coverage-report=html --no-browser",
"sync": "node sync.js"
},

@@ -29,4 +30,5 @@ "repository": {

"devDependencies": {
"cloudscraper": "^4.1.2",
"tap": "^12.4.0"
}
}

@@ -6,3 +6,3 @@ # real-user-agent

Get an up-to-date user-agent string, sourced from the [most common user agents](https://techblog.willshouse.com/2012/01/03/most-common-user-agents/). A simple cache, invalidated every 2 hours, prevents hammering the data source. A data cap is implemented in the request. There is a fallback string in case the data is corrupt or host is unreachable.
Get an up-to-date user-agent string, sourced from the [most common user agents](https://techblog.willshouse.com/2012/01/03/most-common-user-agents/). To avoid each use of this module hammering the source, the data is now self-hosted with [a gist](https://gist.githubusercontent.com/fijimunkii/952acac988f2d25bef7e0284bc63c406/raw/ua.json), updated in the build process. A simple local cache, invalidated every 2 hours, prevents extra requests. A data cap is implemented in the request. There is a fallback string in case the data is corrupt or host is unreachable.

@@ -9,0 +9,0 @@ ```js

Sorry, the diff of this file is not supported yet

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