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.
34 lines
562 B
34 lines
562 B
import got from 'got'
|
|
import { XMLParser } from 'fast-xml-parser'
|
|
|
|
import RequestHandler from './requestHandler.js'
|
|
|
|
/**
|
|
*
|
|
*
|
|
*
|
|
*
|
|
*/
|
|
|
|
class RssHandler extends RequestHandler
|
|
{
|
|
/**
|
|
* getting rss feed from url
|
|
*
|
|
*
|
|
*/
|
|
async send()
|
|
{
|
|
const buffer = await got(this.source.url, {
|
|
responseType: 'buffer',
|
|
resolveBodyOnly: true
|
|
})
|
|
|
|
const parser = new XMLParser()
|
|
const feed = parser.parse(buffer.toString())
|
|
|
|
this.processActions(feed)
|
|
}
|
|
}
|
|
|
|
export default RssHandler |