Compare commits
No commits in common. "f52d89ad2417ec483bd6d06e9710beb84fe5e30d" and "f27795fcfe1b645d93a80d0dd8d948f76360b1ea" have entirely different histories.
f52d89ad24
...
f27795fcfe
|
@ -36,16 +36,6 @@ pub struct Args {
|
|||
pub verify: bool,
|
||||
}
|
||||
|
||||
/// A simple feed struct.
|
||||
#[derive(Debug)]
|
||||
pub struct Feed {
|
||||
/// The text to use for the feed in the OPML output.
|
||||
pub text: Option<String>,
|
||||
|
||||
/// The URL of the feed.
|
||||
pub url: String,
|
||||
}
|
||||
|
||||
fn main() -> Result<()> {
|
||||
install()?;
|
||||
|
||||
|
@ -59,10 +49,8 @@ fn main() -> Result<()> {
|
|||
let mut feeds_to_output = vec![];
|
||||
|
||||
for appid in args.appid {
|
||||
potential_feeds.push(Feed {
|
||||
text: Some(format!("Steam AppID {appid}")),
|
||||
url: format!("https://steamcommunity.com/games/{appid}/rss/"),
|
||||
});
|
||||
potential_feeds
|
||||
.push(format!("https://steamcommunity.com/games/{appid}/rss/"));
|
||||
}
|
||||
|
||||
if args.verify {
|
||||
|
@ -70,15 +58,9 @@ fn main() -> Result<()> {
|
|||
.with_style(ProgressStyle::with_template("Verifying {pos}/{len} {bar}")?);
|
||||
|
||||
for potential_feed in potential_feeds {
|
||||
let response = ureq_agent.get(&potential_feed.url).call()?;
|
||||
let response = ureq_agent.get(&potential_feed).call()?;
|
||||
if response.content_type() == "text/xml" {
|
||||
let body = response.into_string()?;
|
||||
let title_start = body.find("<title>").unwrap() + 7;
|
||||
let title_end = body.find("</title>").unwrap();
|
||||
feeds_to_output.push(Feed {
|
||||
text: Some(body[title_start..title_end].to_string()),
|
||||
url: potential_feed.url,
|
||||
});
|
||||
feeds_to_output.push(potential_feed);
|
||||
}
|
||||
|
||||
sleep(timeout);
|
||||
|
@ -89,14 +71,11 @@ fn main() -> Result<()> {
|
|||
}
|
||||
|
||||
let mut opml_document = opml::OPML::default();
|
||||
opml_document.head = None;
|
||||
|
||||
for feed in feeds_to_output {
|
||||
if args.opml {
|
||||
opml_document
|
||||
.add_feed(&feed.text.unwrap_or_else(|| feed.url.clone()), &feed.url);
|
||||
opml_document.add_feed(&feed, &feed);
|
||||
} else {
|
||||
println!("{}", feed.url);
|
||||
println!("{feed}");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue