KawAnime/server/mal/scrap.js

21 lines
538 B
JavaScript

const malScraper = require('mal-scraper')
const {Logger} = require('../utils')
const logger = new Logger('Mal-Scraper')
const getWatchList = ({query}, res) => {
const {user} = query
logger.info('Looking for the watch lists of ' + user + '...')
malScraper.getWatchListFromUser(user)
.then((data) => res.send(data.lists))
.catch(/* istanbul ignore next */ (err) => {
logger.error('An error occurred while gathring watchLIst from user.', err)
res.status(204).send()
})
}
module.exports = {
getWatchList
}