generaljavascript31
InboxKitten - Temporary Email Scraper & Reader
API scraper for inboxkitten.com serverless disposable email. Reads inbox lists, mail metadata, and complete HTML email content.
Vamz Spectre6 Nov 202685 baris kode
Jalankan via Terminal / CLI:
# 1. Download file script
curl -sL "https://code.vamxapi.my.id/snippet/raw/inboxkitten" -o inboxkitten.js
# 2. Jalankan script
node inboxkitten.js
inboxkitten.js(85 lines)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/**
* InboxKitten Temporary Email Scraper & Mail Reader
* Author: Vamz Spectre (VamxAPI)
* Target: https://inboxkitten.com
* Description:
* Serverless disposable email client for InboxKitten.
* Check public inboxes, read metadata, and extract full HTML body.
*
* Usage CLI:
* curl -sL "https://code.vamxapi.my.id/snippet/raw/inboxkitten" -o inboxkitten.js
* node inboxkitten.js list demo
* node inboxkitten.js get us-west1 <storageKey>
*/
const HEADERS = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36'
};
const BASE = 'https://inboxkitten.com/api/v1/mail';
async function listInbox(recipient) {
const clean = (recipient || '').replace(/@.*$/, '').trim();
if (!clean) throw new Error('Recipient name is required (e.g. demo)');
const res = await fetch(`${BASE}/list?recipient=${encodeURIComponent(clean)}`, { headers: HEADERS });
if (!res.ok) throw new Error(`InboxKitten list failed: ${res.status}`);
const data = await res.json();
return {
status: true,
author: 'Vamz Spectre',
provider: 'inboxkitten.com',
recipient: `${clean}@inboxkitten.com`,
count: data.length,
messages: data.map(m => ({
id: m.id,
timestamp: m.timestamp ? new Date(m.timestamp * 1000).toISOString() : null,
sender: m.message?.headers?.from || m.envelope?.sender,
subject: m.message?.headers?.subject || '(No Subject)',
storage: m.storage
}))
};
}
async function getMessage(region, key) {
if (!region || !key) throw new Error('region and key are required');
const [metaRes, htmlRes] = await Promise.all([
fetch(`${BASE}/getKey?region=${encodeURIComponent(region)}&key=${encodeURIComponent(key)}`, { headers: HEADERS }),
fetch(`${BASE}/getHtml?region=${encodeURIComponent(region)}&key=${encodeURIComponent(key)}`, { headers: HEADERS })
]);
const meta = metaRes.ok ? await metaRes.json() : {};
const html = htmlRes.ok ? await htmlRes.text() : '';
return {
status: true,
author: 'Vamz Spectre',
provider: 'inboxkitten.com',
metadata: meta,
htmlBody: html
};
}
// CLI Runner
if (require.main === module) {
const action = (process.argv[2] || 'list').toLowerCase();
const arg1 = process.argv[3] || 'demo';
const arg2 = process.argv[4];
(async () => {
try {
let result;
if (action === 'get') {
result = await getMessage(arg1, arg2);
} else {
result = await listInbox(arg1);
}
console.log(JSON.stringify(result, null, 2));
} catch (err) {
console.error(JSON.stringify({ status: false, error: err.message }, null, 2));
process.exit(1);
}
})();
}
module.exports = {
listInbox,
getMessage
};