You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
687 B

1 year ago
import got from 'got'
import { XMLParser } from 'fast-xml-parser'
import RequestHandler from './../../src/runner/requests/requestHandler.js'
/**
* RssHandler
*
* request rss from url and parse to object
*
* @author Björn Hase <me@herr-hase.wtf>
*
*/
class RssHandler extends RequestHandler {
/**
* getting rss feed from url
*
*
*/
async send() {
const buffer = await got(this.config.url, {
responseType: 'buffer',
resolveBodyOnly: true
})
const parser = new XMLParser()
const feed = parser.parse(buffer.toString())
this.processActions(feed)
}
}
export default RssHandler