forked from DGXeon/Vimdhayak-Bot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgame.js
162 lines (155 loc) · 7.28 KB
/
game.js
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
const cheerio = require('cheerio')
const fetch = require('node-fetch')
const axios = require('axios')
const fs = require('fs')
function asahotak() {
return new Promise((resolve, reject) => {
fetch('https://www.cademedia.com/jawaban-tebak-tebakan-asah-otak')
.then(res => res.text())
.then(res => {
const $ = cheerio.load(res)
data = []
go = $('body').find('div.entry-content').text().split('P:')
for (let i = 2; i < go.length; i++) {
x = (go[i].split('J:')[0]).trim()
switch (i) {
case 229: y = (go[i].split('J:')[1].split('Level')[0].split('Demikian')[0]).trim()
break; default: y = (go[i].split('J:')[1].split('Level')[0]).trim()
} data.push({ pertanyaan: x, jawaban: y })
}
// save json
// fs.writeFileSync('./asahotak.json', JSON.stringify(data))
resolve(data)
}).catch(reject)
})
}
function family100() {
return new Promise((resolve, reject) => {
fetch('https://teknologital.com/kunci-jawaban-ica-ica')
.then(res => res.text())
.then(res => {
const $ = cheerio.load(res)
data = []
go = $('body').find('div.entry-content').text().split('Jawaban :')
for (let i = 1; i < go.length; i++) {
y = (go[i - 1].split('\n')[1]).trim()
z = (go[i].split('\n')[0]).trim()
if (i !== 1) {
data.push({ pertanyaan: y, jawaban: z })
}
}
// save json
// fs.writeFileSync('./ica.json', JSON.stringify(data))
resolve(data)
}).catch(reject)
})
}
function siapakah() {
return new Promise((resolve, reject) => {
fetch('https://tutorialaplikasi.com/kunci-jawaban-tebak-siapakah-aku/')
.then(res => res.text())
.then(res => {
const $ = cheerio.load(res)
let data = []
$('body').find('li').each(function (index, element) {
let x = $(this).html().split('<strong>')[0]
let y = $(this).find('strong').text()
data.push({ pertanyaan: x, jawaban: y })
})
data.splice(0, 11)
data.splice(100, 131)
resolve(data)
}).catch(reject)
})
}
function siapakah2() {
return new Promise((resolve, reject) => {
fetch('https://jagat-nusantara.blogspot.com/2018/01/kunci-jawaban-tebak-siapakah-aku-m.html')
.then(res => res.text())
.then(res => {
const $ = cheerio.load(res)
data = []
go = $('article').find('div[id="adsmiddle27044024372030888142"]').text()
for (let i = 0; i < 534; i++) {
x = go.split(i + '.')[1].split('\n')[0].trim()
y = go.split(i + '.')[1].split('Answer:')[1].split('\n')[0].trim()
data.push({ pertanyaan: x, jawaban: y })
} resolve(data)
}).catch(reject)
})
}
function susunkata() {
return new Promise((resolve, reject) => {
fetch('https://www.cademedia.com/jawaban-tebak-tebakan-susun-kata')
.then(res => res.text())
.then(res => {
const $ = cheerio.load(res)
data = []
go = $('body').find('article').text()
for (let i = 2; i < 350; i++) {
v = go.split('Level ' + i)[1].split(':')[0]
x = go.split('Level ' + i)[1].split(':')[1]
if (i !== 21 && i !== 51 && i !== 101 && i !== 151 && i !== 201 && i !== 251 && i !== 301) {
if (i == 50 || i == 100 || i == 150 || i == 200 || i == 250 || i == 250 || i == 300) {
y = go.split('Level ' + i)[1].split('Jawaban')[1].split('Susun')[0]
} else {
y = go.split('Level ' + i)[1].split('Jawaban')[1].split('Level')[0]
}
data.push({ tipe: v.trim(), acak: x.replace(/(Jawaban)/gi, '').trim(), jawaban: y.replace(/:/g, '').trim() })
// save json
// fs.writeFileSync('./susunkata.json', JSON.stringify(data))
}
}
data.splice(0, 2)
resolve(data)
}).catch(reject)
})
}
function tekateki() {
return new Promise((resolve, reject) => {
fetch('https://www.kabargames.id/kunci-jawaban-tebak-tebakan-2020')
.then(res => res.text())
.then(res => {
const $ = cheerio.load(res)
data = []
go = $('body').find('div.post__content').text()
for (let i = 1; i < 201; i++) {
v = (go.split('Level ' + i + 'Pertanyaan:')[1].split('Jawaban')[0]).trim()
switch (i) {
case 1: x = go.split('Level ' + i + ' – 20Level ' + i)[1].split('Answer:')[1]
break
case 21: x = go.split('Level ' + i + ' – 40Level ' + i)[1].split('Answer:')[1]
break
case 41: x = go.split('Level ' + i + ' – 60Level ' + i)[1].split('Answer:')[1]
break
case 61: x = go.split('Level ' + i + ' – 80Level ' + i)[1].split('Answer:')[1]
break
case 81: x = go.split('Level ' + i + ' – 100Level ' + i)[1].split('Answer:')[1]
break
case 101: x = go.split('Level ' + i + ' – 120Level ' + i)[1].split('Answer:')[1]
break
case 121: x = go.split('Level ' + i + ' – 140Level ' + i)[1].split('Answer:')[1]
break
case 141: x = go.split('Level ' + i + ' – 160Level ' + i)[1].split('Answer:')[1]
break
case 161: x = go.split('Level ' + i + ' – 180Level ' + i)[1].split('Answer:')[1]
break
case 181: x = go.split('Level ' + i + ' – 200Level ' + i)[1].split('Answer:')[1]
break
default: x = go.split('Level ' + i)[1].split('Answer:')[1]
}
if (i == 20 || i == 40 || i == 60 || i == 80 || i == 100 || i == 120 || i == 140 || i == 160 || i == 180) {
y = (x.split('Key')[0]).trim()
} else if (i == 200) {
y = (x.split('now')[0]).trim()
} else {
y = (x.split('Level')[0]).trim()
}
data.push({ pertanyaan: v, jawaban: y })
// save json
// fs.writeFileSync('./tekateki.json', JSON.stringify(data))
} resolve(data)
}).catch(reject)
})
}
module.exports = { asahotak, family100, siapakah, siapakah2, susunkata, tekateki }