-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgetCommentaryData.js
48 lines (41 loc) · 1.68 KB
/
getCommentaryData.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
const fs = require("fs")
const axios = require("axios")
let jsdom = require('jsdom')
module.exports = async(book, chapter, verse) => {
return new Promise((resolve, reject) => {
const url = `https://biblehub.com/commentaries/${book.toLowerCase().replace(/\s/g, "_")}/${chapter}-${verse}.htm`
axios({
url: url
}).then( (res) => {
// console.log(res.data);
fs.writeFileSync(`./BibleHub/commentaries/html/${book}/${chapter}/${verse}.htm`, res.data)
// const {JSDOM} = jsdom
// let {document} = (new JSDOM(res.data)).window
// let data = []
// const word = [...document.querySelectorAll(".word")].map(e => e.textContent)
// const grk = [...document.querySelectorAll(".grk")].map(e => e.textContent)
// const heb = [...document.querySelectorAll(".heb")].map(e => e.textContent)
// const translit = [...document.querySelectorAll(".translit")].map(e => e.textContent)
// const parse = [...document.querySelectorAll(".parse")].map(e => e.textContent)
// const str = [...document.querySelectorAll(".str")].map(e => e.textContent)
// const str2 = [...document.querySelectorAll(".str2")].map(e => e.textContent)
// const num = [...document.querySelectorAll(".str")].map(e => e.textContent.match(/\d+/g)[0])
// for(let i=0; i<word.length;i++){
// data.push({
// word: word[i],
// grk: grk[i],
// heb: heb[i],
// translit: translit[i],
// parse: parse[i],
// str: str[i],
// str2: str2[i],
// num: num[i]
// })
// }
// resolve(data)
resolve()
}).catch((error) => {
console.log(error);
})
})
}