user-agents
Advanced tools
Comparing version 0.0.2 to 0.0.4
{ | ||
"name": "user-agents", | ||
"version": "0.0.2", | ||
"description": "Exports a list of various user-agents, useful for scraping ", | ||
"main": "index.js", | ||
"keywords": [ | ||
"scraping", | ||
"user-agent" | ||
], | ||
"author": { | ||
"name" : "Vitaly Aminev", | ||
"email": "getstarted@avvs.co" | ||
"version": "0.0.4", | ||
"description": "A JavaScript library for generating random user agents. ", | ||
"main": "dist/index.js", | ||
"repository": "git@github.com:intoli/user-agents.git", | ||
"author": "Intoli, LLC <contact@intoli.com>", | ||
"license": "BSD-2-Clause", | ||
"private": false, | ||
"scripts": { | ||
"build": "NODE_ENV=production webpack", | ||
"lint": "eslint src/", | ||
"postversion": "git push && git push --tags", | ||
"test": "NODE_ENV=testing mocha --exit --require babel-register", | ||
"update-data": "babel-node src/update-data.js src/user-agents.json" | ||
}, | ||
"license": "MIT" | ||
} | ||
"devDependencies": { | ||
"babel": "^6.23.0", | ||
"babel-cli": "^6.26.0", | ||
"babel-core": "^6.26.3", | ||
"babel-eslint": "^8.2.3", | ||
"babel-loader": "^7.1.4", | ||
"babel-plugin-transform-builtin-extend": "^1.1.2", | ||
"babel-plugin-transform-class-properties": "^6.24.1", | ||
"babel-plugin-transform-object-rest-spread": "^6.26.0", | ||
"babel-preset-env": "^1.7.0", | ||
"babel-preset-power-assert": "^2.0.0", | ||
"babel-register": "^6.26.0", | ||
"eslint": "^4.19.1", | ||
"eslint-config-airbnb": "^16.1.0", | ||
"eslint-loader": "^2.0.0", | ||
"eslint-plugin-import": "^2.12.0", | ||
"imports-loader": "^0.8.0", | ||
"mocha": "^5.2.0", | ||
"power-assert": "^1.5.0", | ||
"source-map-support": "^0.5.6", | ||
"webpack": "^4.10.2", | ||
"webpack-cli": "^2.1.4" | ||
}, | ||
"dependencies": { | ||
"cheerio": "^1.0.0-rc.2", | ||
"dot-json": "^1.0.4" | ||
} | ||
} |
@@ -1,5 +0,62 @@ | ||
# User agents list | ||
simply export a list, or get a random user-agent header: | ||
var agents = require('user-agents'); | ||
var agent = agents.random(); | ||
# User Agents | ||
User Agents is a JavaScript module for generating random user agents according to how frequently they're used in the wild. | ||
This is useful for web scraping because it's often desired to create realistic traffic patterns. | ||
There are several other similar projects for generating random user agents, but User Agents is the only one that automatically publishes new versions with updated data on a regular basis. | ||
This ensures that your user agents will always be realistic and up to date. | ||
## Installation | ||
The User Agents package is available on npm with the package name [user-agents](https://npmjs.com/package/user-agents). | ||
You can install it using your favorite JavaScript package manager in the usual way. | ||
```bash | ||
# With npm: npm install user-agents | ||
# With pnpm: pnpm install user-agents | ||
# With yarn: | ||
yarn add user-agents | ||
``` | ||
## Usage | ||
The `userAgents.random()` method can be used to generate a random user agent. | ||
The most common user agents are weighted with higher probabilities so that the randomly generated user agents will follow realistic probability distributions. | ||
For example, the following code snippet will generate five random user agents based on these probabilities. | ||
```javascript | ||
// Import the User Agents package. | ||
const userAgents = require('user-agents'); | ||
// Log out five random user agents. | ||
for (let i = 0; i < 5; i++) { | ||
const userAgent = userAgents.random(); | ||
console.log(userAgents); | ||
}; | ||
``` | ||
The output will be random, and will also depend on which package version you're using, but a typical output would look something like this. | ||
```literal | ||
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:61.0) Gecko/20100101 Firefox/61.0 | ||
Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36 | ||
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.1.2 Safari/605.1.15 | ||
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36 | ||
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36 | ||
``` | ||
## Acknowledgements | ||
The user agent frequency data used in this library is currently provided by the [Will's House Tech Blog](https://techblog.willshouse.com/2012/01/03/most-common-user-agents/). | ||
## Contributing | ||
Contributions are welcome, but please follow these contributor guidelines outlined in [CONTRIBUTING.md](CONTRIBUTING.md). | ||
## License | ||
Slice is licensed under a [BSD 2-Clause License](LICENSE) and is copyright [Intoli, LLC](https://intoli.com). |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
251542
13
579
63
2
21
3
3
+ Addedcheerio@^1.0.0-rc.2
+ Addeddot-json@^1.0.4
+ Addedboolbase@1.0.0(transitive)
+ Addedcheerio@1.0.0(transitive)
+ Addedcheerio-select@2.1.0(transitive)
+ Addedcss-select@5.1.0(transitive)
+ Addedcss-what@6.1.0(transitive)
+ Addeddetect-indent@6.0.0(transitive)
+ Addeddocopt@0.6.2(transitive)
+ Addeddom-serializer@2.0.0(transitive)
+ Addeddomelementtype@2.3.0(transitive)
+ Addeddomhandler@5.0.3(transitive)
+ Addeddomutils@3.1.0(transitive)
+ Addeddot-json@1.3.0(transitive)
+ Addedencoding-sniffer@0.2.0(transitive)
+ Addedentities@4.5.0(transitive)
+ Addedhtmlparser2@9.1.0(transitive)
+ Addediconv-lite@0.6.3(transitive)
+ Addednth-check@2.1.1(transitive)
+ Addedparse5@7.2.1(transitive)
+ Addedparse5-htmlparser2-tree-adapter@7.1.0(transitive)
+ Addedparse5-parser-stream@7.1.2(transitive)
+ Addedsafer-buffer@2.1.2(transitive)
+ Addedunderscore@1.13.7(transitive)
+ Addedunderscore-keypath@0.0.22(transitive)
+ Addedundici@6.20.1(transitive)
+ Addedwhatwg-encoding@3.1.1(transitive)
+ Addedwhatwg-mimetype@4.0.0(transitive)