-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmemberDetail.js
More file actions
49 lines (48 loc) · 1.17 KB
/
Copy pathmemberDetail.js
File metadata and controls
49 lines (48 loc) · 1.17 KB
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
const axios = require('axios')
const { getBiodata, removeTag } = require('./helper');
axios.get('https://jkt48.com/member/detail/id/180?lang=id')
.then(({data}) => {
const biodata = getBiodata(data)
let result = {}
let key = ''
biodata.forEach(bio => {
const isContent = /bioright/.test(bio)
const content = removeTag(bio)
if (!isContent) {
switch (content) {
case 'Nama':
result.name = ''
key = 'name'
break;
case 'Tanggal Lahir':
result.birthdate = ''
key = 'birthdate'
break;
case 'Golongan Darah':
result.bloodType = ''
key = 'bloodType'
break;
case 'Horoskop':
result.horoscope = ''
key = 'horoscope'
break;
case 'Tinggi Badan':
result.height = ''
key = 'height'
break;
case 'Nama Panggilan':
result.nickname = ''
key = 'nickname'
break;
default:
result[content]
key = content
break;
}
} else {
result[key] = content
}
})
console.log(result)
})
.catch(err => console.log(err))