Fix volume en
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Michel Roux 2021-06-11 23:12:44 +02:00
parent 94c4f7d910
commit dbe61e793c

View File

@ -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'))
})
}
})