fakexy-to-json
v1.0.0
Published
Fetch and parse fakexy.com data to JSON. Fake addresses, profiles, credit cards by country.
Maintainers
Readme
fakexy-to-json
Fetch and parse fakexy.com data to JSON. Get fake addresses, profiles, and credit cards by country.
Important: fakexy.com is protected by Cloudflare. You must pass a valid cf_clearance cookie to get real data. Without it, requests will return 403. See Cloudflare cookie below for how to obtain it.
Install
npm install fakexy-to-jsonUsage
import { getAddress, getProfile, getCreditCard } from 'fakexy-to-json';
// Pass the cf_clearance cookie (required - see Cloudflare section below)
const address = await getAddress({
countryCode: 'us',
headers: {
Cookie: 'cf_clearance=YOUR_COOKIE_VALUE',
},
});
console.log(address);
// { street, city, region, zipcode, phone, country, latitude?, longitude?, person?, creditcard? }
// Get a fake profile (US with state)
const profile = await getProfile({
countryCode: 'us',
stateCode: 'ca',
headers: { Cookie: 'cf_clearance=YOUR_COOKIE_VALUE' },
});
console.log(profile);
// { name, gender, birthday, ssn }
// Get a fake credit card
const card = await getCreditCard({
brand: 'visa',
headers: { Cookie: 'cf_clearance=YOUR_COOKIE_VALUE' },
});
console.log(card);
// { brand, number, expire, cvv }Cloudflare cookie
fakexy.com is behind Cloudflare. To get the cf_clearance cookie:
- Open fakexy.com in your browser
- Pass the "Just a moment..." challenge (wait for the page to load)
- Open DevTools → Application → Cookies →
https://www.fakexy.com - Copy the
cf_clearancevalue - Pass it in the
headersoption:headers: { Cookie: 'cf_clearance=YOUR_VALUE' }
The cookie expires after some time; you'll need to refresh it when requests start failing again.
API
getAddress(options?)
Fetches a fake address. Options:
countryCode– Two-letter country code (e.g.'us','uk','de'). Default:'us'stateCode– State/region for countries that support it (e.g.'ca','mi'for US)headers– Custom HTTP headers. Required: includeCookie: cf_clearance=...(see Cloudflare cookie)timeout– Request timeout in ms (default: 10000)
getProfile(options?)
Fetches a fake person profile. Options: same as getAddress.
getCreditCard(options?)
Fetches a fake credit card. Options:
brand–'visa','mastercard','amex','discover'. Default:'visa'headers,timeout– Same as above
Error Handling
The package throws typed errors you can catch and handle:
import {
getAddress,
FakexyNetworkError,
FakexyHttpError,
FakexyParseError,
} from 'fakexy-to-json';
try {
const address = await getAddress({
countryCode: 'us',
headers: { Cookie: 'cf_clearance=YOUR_VALUE' },
});
} catch (err) {
if (err instanceof FakexyNetworkError) {
console.error('Network failed:', err.url, err.cause);
} else if (err instanceof FakexyHttpError) {
console.error('HTTP error:', err.status, err.url);
} else if (err instanceof FakexyParseError) {
console.error('Parse failed - site structure may have changed');
}
}Chrome Extension
The package works in Chrome extension background scripts or service workers. Add host_permissions to your manifest.json:
{
"manifest_version": 3,
"host_permissions": ["https://www.fakexy.com/*"]
}Note: Content scripts run in page context and are subject to CORS. Call the package from the background script and use chrome.runtime.sendMessage to pass results to content scripts or popup. Use the chrome.cookies API to read cf_clearance for fakexy.com and pass it in headers.
Types
All types are exported for use in your code:
import type {
AddressResult,
PersonResult,
CreditCardResult,
} from 'fakexy-to-json';Supported Countries
Use SUPPORTED_COUNTRIES for the full list:
import { SUPPORTED_COUNTRIES } from 'fakexy-to-json';
// ['ar', 'au', 'bd', 'be', 'br', 'ca', 'cn', ...]Disclaimer
This package is unofficial and not affiliated with, endorsed by, or sponsored by fakexy.com. You are responsible for complying with fakexy.com's terms of service and acceptable use policies when using this library, and for using any data only in lawful ways.
License
MIT
