Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
MR414N-ID
GitHub Repository: MR414N-ID/botku2
Path: blob/master/node_modules/@bochilteam/scraper/lib/esm/primbons/nomorhoki.js
1126 views
1
import got from 'got';
2
import { ScraperError } from '../utils.js';
3
export default async function nomorhoki(nomer) {
4
var _a, _b, _c, _d;
5
const config = {
6
nomer: encodeURIComponent(nomer),
7
submit: '+Submit!+'
8
};
9
const data = await got
10
.post('https://www.primbon.com/no_hoki_bagua_shuzi.php', {
11
headers: {
12
'content-type': 'application/x-www-form-urlencoded'
13
},
14
form: config
15
})
16
.text();
17
const results = data
18
.split('</b><br></td></tr><tr><td')[0]
19
.split(`<br><b>No. HP : ${nomer}</b><br>`)[1];
20
const angka_bagua_shuzi = parseInt((_b = (_a = results === null || results === void 0 ? void 0 : results.split('Angka Bagua Shuzi :')[1]) === null || _a === void 0 ? void 0 : _a.split('</b><br><br>')[0]) === null || _b === void 0 ? void 0 : _b.replace(/&#37/gi, ''));
21
if (!angka_bagua_shuzi)
22
throw new ScraperError(`Can't get data, maybe your number(${nomer}) invalid!`);
23
const kekayaan = parseInt(results.split('Kekayaan =')[1].split('<br>')[0]);
24
const kesehatan = parseInt(results.split('Kesehatan =')[1].split('<br>')[0]);
25
const cinta = parseInt(results.split('Cinta/Relasi =')[1].split('<br>')[0]);
26
const kestabilan = parseInt(results.split('Kestabilan =')[1].split('<br>')[0]);
27
const positif = parseInt((_c = results
28
.split('</b><br></td><td><!-- space -->')[0]
29
.split('b>% = ')[1]) === null || _c === void 0 ? void 0 : _c.replace(/&#37/gi, ''));
30
const perselisihan = parseInt(results.split('Perselisihan =')[1].split('<br>')[0]);
31
const kehilangan = parseInt(results.split('Kehilangan =')[1].split('<br>')[0]);
32
const malapetaka = parseInt(results.split('Malapetaka =')[1].split('<br>')[0]);
33
const Kehancuran = parseInt(results.split('Kehancuran =')[1].split('<br>')[0]);
34
const negatif = parseInt((_d = results.split('Kehancuran =')[1].split('<b>% =')[1]) === null || _d === void 0 ? void 0 : _d.replace(/&#37/gi, ''));
35
return {
36
nomer: nomer,
37
angka_bagua_shuzi,
38
positif: {
39
kekayaan,
40
kesehatan,
41
cinta,
42
kestabilan,
43
positif
44
},
45
negatif: {
46
perselisihan,
47
kehilangan,
48
malapetaka,
49
Kehancuran,
50
negatif
51
}
52
};
53
}
54
//# sourceMappingURL=nomorhoki.js.map
55