human-browser 3.5.0 → 3.6.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/README.md +6 -1
- package/package.json +1 -1
- package/scripts/browser-human.js +15 -7
package/README.md
CHANGED
|
@@ -26,11 +26,14 @@ Human Browser solves this by combining:
|
|
|
26
26
|
|
|
27
27
|
## Quick Start
|
|
28
28
|
|
|
29
|
+
**No setup required** — just call `launchHuman()` and it automatically activates a free trial:
|
|
30
|
+
|
|
29
31
|
```js
|
|
30
32
|
const { launchHuman } = require('./scripts/browser-human');
|
|
31
33
|
|
|
32
|
-
//
|
|
34
|
+
// 🚀 Zero config — auto-fetches trial credentials from humanbrowser.dev
|
|
33
35
|
const { browser, page, humanType, humanClick, humanScroll, sleep } = await launchHuman();
|
|
36
|
+
// Output: 🎉 Human Browser trial activated! (~100MB Romania residential IP)
|
|
34
37
|
|
|
35
38
|
// Specific country
|
|
36
39
|
const { page } = await launchHuman({ country: 'us' }); // US residential IP
|
|
@@ -46,6 +49,8 @@ await humanClick(page, 760, 400);
|
|
|
46
49
|
await browser.close();
|
|
47
50
|
```
|
|
48
51
|
|
|
52
|
+
> **Trial exhausted?** Get a paid plan at https://humanbrowser.dev, then set `PROXY_USER` / `PROXY_PASS` in your `.env`.
|
|
53
|
+
|
|
49
54
|
---
|
|
50
55
|
|
|
51
56
|
## Setup
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "human-browser",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.6.0",
|
|
4
4
|
"description": "Stealth browser for AI agents. Bypasses Cloudflare, DataDome, PerimeterX. Residential IPs from 10+ countries. iPhone 15 Pro fingerprint. Drop-in Playwright replacement — launchHuman() just works.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"browser-automation",
|
package/scripts/browser-human.js
CHANGED
|
@@ -37,20 +37,18 @@ const COUNTRY_META = {
|
|
|
37
37
|
function buildProxy(country = 'ro') {
|
|
38
38
|
const c = country.toLowerCase();
|
|
39
39
|
|
|
40
|
-
// Proxy config — use env vars
|
|
41
|
-
const PROXY_HOST = process.env.PROXY_HOST || '
|
|
40
|
+
// Proxy config — use env vars (set manually or auto-fetched via getTrial())
|
|
41
|
+
const PROXY_HOST = process.env.PROXY_HOST || '';
|
|
42
42
|
const PROXY_PORT = process.env.PROXY_PORT || '13001';
|
|
43
|
-
const PROXY_USER = process.env.PROXY_USER || '
|
|
44
|
-
const PROXY_PASS = process.env.PROXY_PASS || '
|
|
43
|
+
const PROXY_USER = process.env.PROXY_USER || '';
|
|
44
|
+
const PROXY_PASS = process.env.PROXY_PASS || '';
|
|
45
45
|
|
|
46
46
|
// Also support legacy env var names for backward compatibility
|
|
47
|
-
const server = process.env.PROXY_SERVER || `http://${PROXY_HOST}:${PROXY_PORT}
|
|
47
|
+
const server = process.env.PROXY_SERVER || (PROXY_HOST ? `http://${PROXY_HOST}:${PROXY_PORT}` : '');
|
|
48
48
|
const username = process.env.PROXY_USERNAME || PROXY_USER;
|
|
49
49
|
const password = process.env.PROXY_PASSWORD || PROXY_PASS;
|
|
50
50
|
|
|
51
51
|
if (!username || !password) {
|
|
52
|
-
console.warn('⚠️ No proxy credentials set. Get them at: https://humanbrowser.dev');
|
|
53
|
-
console.warn(' Set PROXY_USER and PROXY_PASS in your .env file.');
|
|
54
52
|
return null;
|
|
55
53
|
}
|
|
56
54
|
|
|
@@ -188,6 +186,16 @@ async function launchHuman(opts = {}) {
|
|
|
188
186
|
headless = true,
|
|
189
187
|
} = opts;
|
|
190
188
|
|
|
189
|
+
// Auto-fetch trial credentials if no proxy is configured
|
|
190
|
+
if (useProxy && !process.env.PROXY_USER && !process.env.PROXY_SERVER && !process.env.PROXY_USERNAME) {
|
|
191
|
+
try {
|
|
192
|
+
await getTrial();
|
|
193
|
+
} catch (e) {
|
|
194
|
+
console.warn('⚠️ Could not fetch trial credentials:', e.message);
|
|
195
|
+
console.warn(' Get credentials at: https://humanbrowser.dev');
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
191
199
|
const meta = COUNTRY_META[country.toLowerCase()] || COUNTRY_META.ro;
|
|
192
200
|
const device = buildDevice(mobile, country);
|
|
193
201
|
const proxy = useProxy ? buildProxy(country) : null;
|