Add AE visual novel (WIP)

This commit is contained in:
Sakura Knoll
2022-04-29 19:53:34 +09:00 Unverified
parent 813490c194
commit db2ccd95a4
34 changed files with 18607 additions and 0 deletions
+34
View File
@@ -0,0 +1,34 @@
import fetch from 'node-fetch'
import fs from 'fs'
import path from 'path'
const numberOfChapters = 31
function getChapterXML(chapterNumber: number) {
return `http://event.houkai3rd.com/avgAntiEntropy/lang_JP/xml/ch${chapterNumber}.xml`
}
async function run() {
for (
let chapterNumber = 1;
chapterNumber <= numberOfChapters;
chapterNumber++
) {
const chapterUrl = getChapterXML(chapterNumber)
const res = await fetch(chapterUrl)
const xmlBuffer = Buffer.from(await res.arrayBuffer())
const destinationPath = path.join(
__dirname,
'../../public/novels/ae/xml/',
`ch${chapterNumber}.xml`
)
fs.writeFileSync(destinationPath, xmlBuffer)
}
}
run()
.then(() => process.exit())
.catch((error) => {
console.error(error)
process.exit(1)
})