设备配置文件
每日更新有加权随机选择的浏览器/设备配置 。 可用于现实的客户端指纹洗刷,测试,负载生成.
数据来自一个网站, 大约65%的移动流量和35%的桌面流量 浏览器配置器 获取数据.
灵感来自 用户代理 这似乎不再更新 缺乏一些我需要的数据.
安装
npm install @denniskrol/device-profiles
基本用途
import { DeviceProfiles } from '@denniskrol/device-profiles';
// Get a weighted random profile
const profile = new DeviceProfiles();
console.log(profile.userAgent, profile.deviceType);
已过滤随机
// Only mobile devices
const mobile = new DeviceProfiles({ deviceType: 'mobile' });
// Regex match browser name
const safari = new DeviceProfiles({ browser: /Safari/ });
// Inclusion list (e.g. mobile OR tablet)
const touch = new DeviceProfiles({ deviceType: ['mobile', 'tablet'] });
// Function predicate (custom logic)
const chromeWithUAData = new DeviceProfiles(profile =>
profile.userAgent.includes('Chrome') && !!profile.userAgentData
);
// Using static random with predicate
const randomChrome = DeviceProfiles.random(profile =>
/Chrome/.test(profile.userAgent) && profile.deviceType === 'desktop'
);
静态助手
import { DeviceProfiles } from '@denniskrol/device-profiles';
// Get array of all profiles
const all = DeviceProfiles.all();
// Get random with filter without instantiating
const randomDesktop = DeviceProfiles.random({ deviceType: 'desktop' });
配置示例
{
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36",
"platform": "Win32",
"deviceMemory": 8,
"hardwareConcurrency": 8,
"vendor": "Google Inc.",
"screenHeight": 720,
"screenWidth": 1280,
"viewportHeight": 568,
"viewportWidth": 1251,
"devicePixelRatio": 1.5,
"webglRenderer": "ANGLE (Intel, Intel(R) UHD Graphics (0x00009B41) Direct3D11 vs_5_0 ps_5_0, D3D11)",
"webglVendor": "Google Inc. (Intel)",
"webGpuArchitecture": "gen-9",
"webGpuVendor": "intel",
"storageQuota": {
"quota": 113282066841,
"usage": 0,
"available": 113282066841
},
"jsHeapSizeLimit": 2248146944,
"fonts": [
"Aldhabi",
"Bahnschrift",
"Cambria Math",
"Gadugi",
"HoloLens MDL2 Assets",
"Ink Free",
"Javanese Text",
"Leelawadee UI",
"Lucida Console",
"MS Outlook",
"Myanmar Text",
"Nirmala UI",
"Segoe MDL2 Assets",
"Segoe UI Emoji"
],
"userAgentData": {
"architecture": "x86",
"bitness": "64",
"brands": [
{
"brand": "Chromium",
"version": "142"
},
{
"brand": "Google Chrome",
"version": "142"
},
{
"brand": "Not_A Brand",
"version": "99"
}
],
"fullVersionList": [
{
"brand": "Chromium",
"version": "142.0.7444.134"
},
{
"brand": "Google Chrome",
"version": "142.0.7444.134"
},
{
"brand": "Not_A Brand",
"version": "99.0.0.0"
}
],
"mobile": false,
"model": null,
"platform": "Windows",
"platformVersion": "10.0.0",
"uaFullVersion": "142.0.7444.134"
},
"weight":26,
"deviceType":"desktop",
"browser":"Chrome",
"osName":"Windows"
}
过滤规则
- 初级平等(deviceType:
'mobile'(中文(简体) ) - 包含列表( deviceType :
['mobile','tablet'](中文(简体) ) - RegExp 匹配( 浏览器 :
/Safari/(中文(简体) ) - 完全自定义逻辑的函数上游( profile QX布尔)
加权选择
每个剖面图都有重量. 随机选择与重量成正比.
JSON 访问
您也可以导入原始 JSON :
import profilesJson from '@denniskrol/device-profiles/deviceprofiles.json';
console.log(profilesJson.length);
许可证
取消许可证