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