A minimalist wrapper around fetch() that adds believable, randomized headers.
npm install hmmfetch
// Import the library
const hmmfetch = require('hmmfetch');
// Use it like normal fetch
hmmfetch('https://example.com')
.then(response => response.text())
.then(data => console.log(data));
You can also pass options just like with regular fetch. Your custom headers will override the default ones.
hmmfetch('https://example.com', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
// This will override the default accept header
'accept': 'application/json'
},
body: JSON.stringify({ key: 'value' })
})
The library automatically randomizes headers with each request. You can customize the randomization:
// Customize the browser profile
hmmfetch('https://example.com', {}, {
// Use a specific browser profile
browser: 'firefox',
// Specify OS
os: 'windows',
// Set language
language: 'fr-FR,fr;q=0.9'
})
You can also generate headers without making a request:
const { generateHeaders } = require('hmmfetch');
// Generate random headers
const headers = generateHeaders();
// Or with specific options
const chromeHeaders = generateHeaders({
browser: 'chrome',
os: 'mac',
language: 'en-US,en;q=0.9'
});
console.log(chromeHeaders);
-
browser
: Which browser profile to use-
'chrome'
: Google Chrome -
'firefox'
: Mozilla Firefox -
'safari'
: Apple Safari -
'edge'
: Microsoft Edge -
'random'
: Random selection (default)
-
-
os
: Which operating system to use-
'windows'
: Windows -
'mac'
: macOS -
'linux'
: Linux (not available for Safari) -
'random'
: Random compatible OS (default)
-
-
language
: Which language to use- Any valid accept-language value
-
'random'
: Random selection (default)
ISC