You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
526 B
TypeScript
21 lines
526 B
TypeScript
5 years ago
|
import Koa from "koa";
|
||
|
import Axios from "axios";
|
||
|
import * as xml2js from "xml2js";
|
||
|
|
||
|
const app = new Koa();
|
||
|
|
||
|
app.use(async (ctx) => {
|
||
|
const { data } = await Axios.get(
|
||
|
"https://podcast.midline.pl/api/v1/channels/Midline/rss"
|
||
|
);
|
||
|
const builder = new xml2js.Builder();
|
||
|
const parsed_data = await xml2js.parseStringPromise(data);
|
||
|
parsed_data.rss.channel[0]["itunes:owner"][0]["itunes:email"] =
|
||
|
"kontakt@mildline.pl";
|
||
|
|
||
|
ctx.body = builder.buildObject(parsed_data);
|
||
|
ctx.type = "application/rss+xml";
|
||
|
});
|
||
|
|
||
|
app.listen(3000);
|