mirror of
https://github.com/YGGverse/pulsarss.git
synced 2026-03-31 17:15:29 +00:00
include title and pub_date as index header
This commit is contained in:
parent
e63d8c116d
commit
058150d23d
1 changed files with 9 additions and 4 deletions
13
src/main.rs
13
src/main.rs
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue