This commit is contained in:
parent
94c4f7d910
commit
dbe61e793c
@ -2,7 +2,6 @@ const cheerio = require('cheerio')
|
||||
const fetch = require('node-fetch')
|
||||
const epub = require('epub-gen')
|
||||
|
||||
const START_VOLUME = 3
|
||||
const books = []
|
||||
|
||||
const metadata = (volume) => ({
|
||||
@ -49,12 +48,10 @@ const fetchPage = async (url) => {
|
||||
content.each((i, el) => {
|
||||
if (i % 2 === 0) {
|
||||
volume = html(el).text().replace(/Volume /, '')
|
||||
if (volume >= START_VOLUME) {
|
||||
books.push(metadata(i))
|
||||
}
|
||||
} else if (volume >= START_VOLUME) {
|
||||
books.push(metadata(volume))
|
||||
} else {
|
||||
html('a', el).each((i, el) => {
|
||||
books[volume - START_VOLUME].links.push(html(el).attr('href'))
|
||||
books[volume - 1].links.push(html(el).attr('href'))
|
||||
})
|
||||
}
|
||||
})
|
||||
|
Reference in New Issue
Block a user