nicer code
This commit is contained in:
@@ -16,36 +16,21 @@ pub async fn stream_handler(State(state): State<Arc<AppState>>) -> impl IntoResp
|
||||
fn feed(urls: &Vec<String>) -> String {
|
||||
let mut ret = String::new();
|
||||
ret.push_str(r#"<?xml version="1.0" encoding="UTF-8"?>"#);
|
||||
ret.push('\n');
|
||||
ret.push_str(r#"<rss version="2.0">"#);
|
||||
ret.push('\n');
|
||||
ret.push_str("<channel>");
|
||||
ret.push('\n');
|
||||
ret.push_str("<title>Ö1 Morgenjournal Feed</title>");
|
||||
ret.push('\n');
|
||||
ret.push_str("<link>https://news.hofer.link</link>");
|
||||
ret.push('\n');
|
||||
ret.push_str("<description>Feed für Ö1 Morgenjournal. Live.</description>");
|
||||
ret.push('\n');
|
||||
|
||||
for url in urls {
|
||||
ret.push_str("<item>");
|
||||
ret.push('\n');
|
||||
ret.push_str(&format!(" <title>Morgenjournal DATE</title>"));
|
||||
ret.push('\n');
|
||||
ret.push_str(&format!(
|
||||
" <link>{}</link>",
|
||||
quick_xml::escape::escape(url)
|
||||
));
|
||||
ret.push('\n');
|
||||
ret.push_str(&format!(" <description>my desc</description>"));
|
||||
ret.push('\n');
|
||||
ret.push_str(&format!("<title>Morgenjournal</title>"));
|
||||
ret.push_str(&format!("<link>{}</link>", quick_xml::escape::escape(url)));
|
||||
ret.push_str(&format!("<description>Morgenjournal</description>"));
|
||||
ret.push_str("</item>");
|
||||
ret.push('\n');
|
||||
}
|
||||
|
||||
ret.push_str(" </channel>");
|
||||
ret.push('\n');
|
||||
ret.push_str("</rss>");
|
||||
|
||||
ret
|
||||
|
Reference in New Issue
Block a user