{"id":13646911,"url":"https://github.com/skratchdot/random-useragent","last_synced_at":"2025-04-12T21:33:52.156Z","repository":{"id":17666791,"uuid":"20471496","full_name":"skratchdot/random-useragent","owner":"skratchdot","description":"Get a random user agent (with an optional filter to select from a specific set of user agents).","archived":false,"fork":false,"pushed_at":"2023-01-24T17:13:01.000Z","size":662,"stargazers_count":251,"open_issues_count":12,"forks_count":37,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-10-19T00:24:36.476Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/skratchdot.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE-MIT","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-06-04T05:36:43.000Z","updated_at":"2024-09-09T05:57:07.000Z","dependencies_parsed_at":"2023-02-13T23:40:17.686Z","dependency_job_id":null,"html_url":"https://github.com/skratchdot/random-useragent","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skratchdot%2Frandom-useragent","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skratchdot%2Frandom-useragent/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skratchdot%2Frandom-useragent/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skratchdot%2Frandom-useragent/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/skratchdot","download_url":"https://codeload.github.com/skratchdot/random-useragent/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248636366,"owners_count":21137438,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-02T01:03:14.957Z","updated_at":"2025-04-12T21:33:52.113Z","avatar_url":"https://github.com/skratchdot.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# random-useragent\n\n[![NPM version](https://badge.fury.io/js/random-useragent.svg)](http://badge.fury.io/js/random-useragent)\n[![Build Status](https://travis-ci.org/skratchdot/random-useragent.png?branch=master)](https://travis-ci.org/skratchdot/random-useragent)\n[![Code Climate](https://codeclimate.com/github/skratchdot/random-useragent.png)](https://codeclimate.com/github/skratchdot/random-useragent)\n[![Coverage Status](https://coveralls.io/repos/skratchdot/random-useragent/badge.svg?branch=master\u0026service=github)](https://coveralls.io/github/skratchdot/random-useragent?branch=master)\n\n[![NPM](https://nodei.co/npm/random-useragent.png)](https://npmjs.org/package/random-useragent)\n\n## Description\n\nGet a random user agent (with an optional filter to select from a specific set of user agents).\n\n## Getting Started\n\nInstall the module with: `npm install random-useragent`\n\n```javascript\nconst randomUseragent = require('random-useragent');\nrandomUseragent.getRandom(); // gets a random user agent string\n```\n\n- [Live example on NPM Runkit](https://npm.runkit.com/random-useragent)\n\n## Documentation\n\n#### .getRandom(filter)\n\nGet a random user agent string (optionally using a filter).\n\nExample Result:\n\n```javascript\n'Mozilla/5.0 (Windows NT 6.2; rv:20.0) Gecko/20121202 Firefox/20.0';\n```\n\n#### .getRandomData(filter)\n\nGet a random user agent's parsed data (optionally using a filter).\n\nExample Result:\n\n```javascript\n{\n\t\"folder\": \"/Browsers - Windows/Legacy Browsers\",\n\t\"description\": \"Firefox 20.0 (Win 8 32)\",\n\t\"userAgent\": \"Mozilla/5.0 (Windows NT 6.2; rv:20.0) Gecko/20121202 Firefox/20.0\",\n\t\"appCodename\": \"\",\n\t\"appName\": \"\",\n\t\"appVersion\": \"\",\n\t\"platform\": \"\",\n\t\"vendor\": \"\",\n\t\"vendorSub\": \"\",\n\t\"browserName\": \"Firefox\",\n\t\"browserMajor\": \"20\",\n\t\"browserVersion\": \"20.0\",\n\t\"deviceModel\": \"\",\n\t\"deviceType\": \"\",\n\t\"deviceVendor\": \"\",\n\t\"engineName\": \"Gecko\",\n\t\"engineVersion\": \"20.0\",\n\t\"osName\": \"Windows\",\n\t\"osVersion\": \"8\",\n\t\"cpuArchitecture\": \"\"\n}\n```\n\n#### .getAll(filter)\n\nGet an array of all the user agent strings (optionally using a filter).\n\n#### .getAllData(filter)\n\nGet an array of all the parsed user agent data (optionally using a filter).\n\n## Examples\n\nGet a random user agent string:\n\n```javascript\nrandomUseragent.getRandom();\n```\n\nGet a random Firefox user agent string:\n\n```javascript\nrandomUseragent.getRandom(function (ua) {\n  return ua.browserName === 'Firefox';\n});\n```\n\nGet a random user agent with a version \u003e= 20:\n\n```javascript\nrandomUseragent.getRandom(function (ua) {\n  return parseFloat(ua.browserVersion) \u003e= 20;\n});\n```\n\n## Source Of User Agents\n\nThe collection of user agents is pulled from the large, regularly updated xml file\nprovided by the author of [User Agent Switcher](http://chrispederick.com/work/user-agent-switcher/),\nwhich is located here:\n\n- [Forum Post](http://techpatterns.com/forums/about304.html)\n- [Direct Link](http://techpatterns.com/downloads/firefox/useragentswitcher.xml)\n\n## Links\n\n- [Source Code](https://github.com/skratchdot/random-useragent)\n- [Changelog](https://github.com/skratchdot/random-useragent/blob/master/CHANGELOG.md)\n- [Live example on Tonic](https://tonicdev.com/npm/random-useragent)\n\n## License\n\nCopyright (c) 2014 skratchdot  \nLicensed under the MIT license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskratchdot%2Frandom-useragent","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fskratchdot%2Frandom-useragent","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskratchdot%2Frandom-useragent/lists"}