include title and pub_date as index header

This commit is contained in:
yggverse 2025-02-18 03:06:48 +02:00
parent e63d8c116d
commit 058150d23d

View file

@ -37,11 +37,10 @@ fn crawl(argument: &Argument, output: &Output) -> Result<(), Box<dyn Error>> {
let mut exist = 0;
let mut index = HashSet::new();
let channel = Channel::read_from(&get(&argument.source)?.bytes()?[..])?;
// collect feed items
for item in Channel::read_from(&get(&argument.source)?.bytes()?[..])?
.items()
.iter()
{
for item in channel.items().iter() {
if argument.limit.is_some_and(|limit| total >= limit) {
break;
}
@ -106,6 +105,12 @@ fn crawl(argument: &Argument, output: &Output) -> Result<(), Box<dyn Error>> {
let mut index = File::create(&index_filename)?;
let mut total = 0;
data.push(format!("# {}", channel.title()));
if let Some(pub_date) = channel.pub_date() {
data.push(format!("## {pub_date}"));
}
for file in files {
if argument.limit.is_some_and(|limit| total >= limit) {
break;