mirror of
https://github.com/comatory/fb2iCal
synced 2025-06-05 22:09:25 +02:00
Server now downloads the HTML file via new endpoint but the parsing logic now happens in the browser. The reason for this is to have a way same code for both environments. If the JavaScript is disabled, it's still possible to call the previous endpoint and download the file from the server.
21 lines
386 B
JavaScript
21 lines
386 B
JavaScript
const crawl = async (url, { logger }) => {
|
|
if (logger) {
|
|
logger.log({
|
|
message: `Crawl started for url: ${url}`,
|
|
level: 'info',
|
|
service: 'parser',
|
|
})
|
|
}
|
|
|
|
return new Promise((resolve, reject) => {
|
|
fetch(url, {
|
|
method: 'GET',
|
|
}).then((response) => {
|
|
console.log(response)
|
|
resolve()
|
|
}).catch(reject)
|
|
})
|
|
}
|
|
|
|
export default crawl
|