@denniskrol/device-profiles 0.0.1 → 1.20251116.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE CHANGED
@@ -1,24 +1,24 @@
1
- This is free and unencumbered software released into the public domain.
2
-
3
- Anyone is free to copy, modify, publish, use, compile, sell, or
4
- distribute this software, either in source code form or as a compiled
5
- binary, for any purpose, commercial or non-commercial, and by any
6
- means.
7
-
8
- In jurisdictions that recognize copyright laws, the author or authors
9
- of this software dedicate any and all copyright interest in the
10
- software to the public domain. We make this dedication for the benefit
11
- of the public at large and to the detriment of our heirs and
12
- successors. We intend this dedication to be an overt act of
13
- relinquishment in perpetuity of all present and future rights to this
14
- software under copyright law.
15
-
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
- IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20
- OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21
- ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22
- OTHER DEALINGS IN THE SOFTWARE.
23
-
24
- For more information, please refer to <https://unlicense.org>
1
+ This is free and unencumbered software released into the public domain.
2
+
3
+ Anyone is free to copy, modify, publish, use, compile, sell, or
4
+ distribute this software, either in source code form or as a compiled
5
+ binary, for any purpose, commercial or non-commercial, and by any
6
+ means.
7
+
8
+ In jurisdictions that recognize copyright laws, the author or authors
9
+ of this software dedicate any and all copyright interest in the
10
+ software to the public domain. We make this dedication for the benefit
11
+ of the public at large and to the detriment of our heirs and
12
+ successors. We intend this dedication to be an overt act of
13
+ relinquishment in perpetuity of all present and future rights to this
14
+ software under copyright law.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
+ IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21
+ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22
+ OTHER DEALINGS IN THE SOFTWARE.
23
+
24
+ For more information, please refer to <https://unlicense.org>
package/README.md CHANGED
@@ -1,145 +1,151 @@
1
- # Device Profiles
2
-
3
- Daily updated browser/device profiles with weighted random selection. Useful for realistic client fingerprint spoofing, testing, load generation.
4
-
5
- Data comes from a website with about 65% mobile and 35% desktop traffic. Uses [browser-profiler](https://github.com/denniskrol/browser-profiler) to get data
6
-
7
- ## Install
8
-
9
- ```bash
10
- npm install @denniskrol/device-profiles
11
- ```
12
-
13
- ## Basic Usage
14
-
15
- ```ts
16
- import DeviceProfiles from '@denniskrol/device-profiles';
17
-
18
- // Get a weighted random profile
19
- const profile = new DeviceProfiles();
20
- console.log(profile.userAgent, profile.deviceType);
21
- ```
22
-
23
- ## Filtered Random
24
-
25
- ```ts
26
- // Only mobile devices
27
- const mobile = new DeviceProfiles({ deviceType: 'mobile' });
28
-
29
- // Regex match browser name
30
- const safari = new DeviceProfiles({ browser: /Safari/ });
31
-
32
- // Inclusion list (e.g. mobile OR tablet)
33
- const touch = new DeviceProfiles({ deviceType: ['mobile', 'tablet'] });
34
- ```
35
-
36
- ## Static Helpers
37
-
38
- ```ts
39
- import { DeviceProfiles } from '@denniskrol/device-profiles';
40
-
41
- // Get array of all profiles
42
- const all = DeviceProfiles.all();
43
-
44
- // Get random with filter without instantiating
45
- const randomDesktop = DeviceProfiles.random({ deviceType: 'desktop' });
46
- ```
47
-
48
- ## Profile example
49
-
50
- ```json
51
- {
52
- "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36",
53
- "platform": "Win32",
54
- "deviceMemory": 8,
55
- "hardwareConcurrency": 8,
56
- "vendor": "Google Inc.",
57
- "screenHeight": 720,
58
- "screenWidth": 1280,
59
- "viewportHeight": 568,
60
- "viewportWidth": 1251,
61
- "devicePixelRatio": 1.5,
62
- "webglRenderer": "ANGLE (Intel, Intel(R) UHD Graphics (0x00009B41) Direct3D11 vs_5_0 ps_5_0, D3D11)",
63
- "webglVendor": "Google Inc. (Intel)",
64
- "webGpuArchitecture": "gen-9",
65
- "webGpuVendor": "intel",
66
- "storageQuota": {
67
- "quota": 113282066841,
68
- "usage": 0,
69
- "available": 113282066841
70
- },
71
- "jsHeapSizeLimit": 2248146944,
72
- "fonts": [
73
- "Aldhabi",
74
- "Bahnschrift",
75
- "Cambria Math",
76
- "Gadugi",
77
- "HoloLens MDL2 Assets",
78
- "Ink Free",
79
- "Javanese Text",
80
- "Leelawadee UI",
81
- "Lucida Console",
82
- "MS Outlook",
83
- "Myanmar Text",
84
- "Nirmala UI",
85
- "Segoe MDL2 Assets",
86
- "Segoe UI Emoji"
87
- ],
88
- "userAgentData": {
89
- "architecture": "x86",
90
- "bitness": "64",
91
- "brands": [
92
- {
93
- "brand": "Chromium",
94
- "version": "142"
95
- },
96
- {
97
- "brand": "Google Chrome",
98
- "version": "142"
99
- },
100
- {
101
- "brand": "Not_A Brand",
102
- "version": "99"
103
- }
104
- ],
105
- "fullVersionList": [
106
- {
107
- "brand": "Chromium",
108
- "version": "142.0.7444.134"
109
- },
110
- {
111
- "brand": "Google Chrome",
112
- "version": "142.0.7444.134"
113
- },
114
- {
115
- "brand": "Not_A Brand",
116
- "version": "99.0.0.0"
117
- }
118
- ],
119
- "mobile": false,
120
- "model": null,
121
- "platform": "Windows",
122
- "platformVersion": "10.0.0",
123
- "uaFullVersion": "142.0.7444.134"
124
- }
125
- }
126
- ```
127
-
128
- ## Filtering Rules
129
- - Primitive equality (deviceType: `'mobile'`)
130
- - Inclusion list (deviceType: `['mobile','tablet']`)
131
- - RegExp match (browser: `/Safari/`)
132
-
133
- ## Weighted Selection
134
- Each profile has a weight. Random selection is proportional to weight.
135
-
136
- ## JSON Access
137
- You can also import the raw JSON:
138
-
139
- ```ts
140
- import profilesJson from '@denniskrol/device-profiles/deviceprofiles.json';
141
- console.log(profilesJson.length);
142
- ```
143
-
144
- ## License
145
- Unlicense
1
+ # Device Profiles
2
+
3
+ Daily updated browser/device profiles with weighted random selection. Useful for realistic client fingerprint spoofing, testing, load generation.
4
+
5
+ Data comes from a website with about 65% mobile and 35% desktop traffic, and uses [browser-profiler](https://github.com/denniskrol/browser-profiler) to get data.
6
+
7
+ This is inspired by [intoli/user-agents](https://github.com/intoli/user-agents) which doesn't seem to get updated anymore and lacks some data that I needed.
8
+
9
+ ## Install
10
+
11
+ ```bash
12
+ npm install @denniskrol/device-profiles
13
+ ```
14
+
15
+ ## Basic Usage
16
+
17
+ ```ts
18
+ import DeviceProfiles from '@denniskrol/device-profiles';
19
+
20
+ // Get a weighted random profile
21
+ const profile = new DeviceProfiles();
22
+ console.log(profile.userAgent, profile.deviceType);
23
+ ```
24
+
25
+ ## Filtered Random
26
+
27
+ ```ts
28
+ // Only mobile devices
29
+ const mobile = new DeviceProfiles({ deviceType: 'mobile' });
30
+
31
+ // Regex match browser name
32
+ const safari = new DeviceProfiles({ browser: /Safari/ });
33
+
34
+ // Inclusion list (e.g. mobile OR tablet)
35
+ const touch = new DeviceProfiles({ deviceType: ['mobile', 'tablet'] });
36
+ ```
37
+
38
+ ## Static Helpers
39
+
40
+ ```ts
41
+ import { DeviceProfiles } from '@denniskrol/device-profiles';
42
+
43
+ // Get array of all profiles
44
+ const all = DeviceProfiles.all();
45
+
46
+ // Get random with filter without instantiating
47
+ const randomDesktop = DeviceProfiles.random({ deviceType: 'desktop' });
48
+ ```
49
+
50
+ ## Profile example
51
+
52
+ ```json
53
+ {
54
+ "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36",
55
+ "platform": "Win32",
56
+ "deviceMemory": 8,
57
+ "hardwareConcurrency": 8,
58
+ "vendor": "Google Inc.",
59
+ "screenHeight": 720,
60
+ "screenWidth": 1280,
61
+ "viewportHeight": 568,
62
+ "viewportWidth": 1251,
63
+ "devicePixelRatio": 1.5,
64
+ "webglRenderer": "ANGLE (Intel, Intel(R) UHD Graphics (0x00009B41) Direct3D11 vs_5_0 ps_5_0, D3D11)",
65
+ "webglVendor": "Google Inc. (Intel)",
66
+ "webGpuArchitecture": "gen-9",
67
+ "webGpuVendor": "intel",
68
+ "storageQuota": {
69
+ "quota": 113282066841,
70
+ "usage": 0,
71
+ "available": 113282066841
72
+ },
73
+ "jsHeapSizeLimit": 2248146944,
74
+ "fonts": [
75
+ "Aldhabi",
76
+ "Bahnschrift",
77
+ "Cambria Math",
78
+ "Gadugi",
79
+ "HoloLens MDL2 Assets",
80
+ "Ink Free",
81
+ "Javanese Text",
82
+ "Leelawadee UI",
83
+ "Lucida Console",
84
+ "MS Outlook",
85
+ "Myanmar Text",
86
+ "Nirmala UI",
87
+ "Segoe MDL2 Assets",
88
+ "Segoe UI Emoji"
89
+ ],
90
+ "userAgentData": {
91
+ "architecture": "x86",
92
+ "bitness": "64",
93
+ "brands": [
94
+ {
95
+ "brand": "Chromium",
96
+ "version": "142"
97
+ },
98
+ {
99
+ "brand": "Google Chrome",
100
+ "version": "142"
101
+ },
102
+ {
103
+ "brand": "Not_A Brand",
104
+ "version": "99"
105
+ }
106
+ ],
107
+ "fullVersionList": [
108
+ {
109
+ "brand": "Chromium",
110
+ "version": "142.0.7444.134"
111
+ },
112
+ {
113
+ "brand": "Google Chrome",
114
+ "version": "142.0.7444.134"
115
+ },
116
+ {
117
+ "brand": "Not_A Brand",
118
+ "version": "99.0.0.0"
119
+ }
120
+ ],
121
+ "mobile": false,
122
+ "model": null,
123
+ "platform": "Windows",
124
+ "platformVersion": "10.0.0",
125
+ "uaFullVersion": "142.0.7444.134"
126
+ },
127
+ "weight":26,
128
+ "deviceType":"desktop",
129
+ "browser":"Chrome",
130
+ "osName":"Windows"
131
+ }
132
+ ```
133
+
134
+ ## Filtering Rules
135
+ - Primitive equality (deviceType: `'mobile'`)
136
+ - Inclusion list (deviceType: `['mobile','tablet']`)
137
+ - RegExp match (browser: `/Safari/`)
138
+
139
+ ## Weighted Selection
140
+ Each profile has a weight. Random selection is proportional to weight.
141
+
142
+ ## JSON Access
143
+ You can also import the raw JSON:
144
+
145
+ ```ts
146
+ import profilesJson from '@denniskrol/device-profiles/deviceprofiles.json';
147
+ console.log(profilesJson.length);
148
+ ```
149
+
150
+ ## License
151
+ Unlicense