scrape image links as well (they do not need auth)
This commit is contained in:
parent
7649026b91
commit
79250a53d3
2 changed files with 62 additions and 19 deletions
|
@ -34,6 +34,7 @@ pub struct Footprint {
|
|||
pub url: String,
|
||||
pub date: Date,
|
||||
pub page: u8,
|
||||
pub images: Vec<String>,
|
||||
}
|
||||
|
||||
const ISO8601_DATE: u128 = iso8601::Config::DEFAULT
|
||||
|
@ -54,11 +55,23 @@ impl Footprint {
|
|||
page_url(root_url, self.page),
|
||||
self.page
|
||||
);
|
||||
// injection again
|
||||
let content = self
|
||||
.images
|
||||
.iter()
|
||||
.map(|x| format!("<img src=\"{}\" /><br />", x))
|
||||
.fold(String::new(), |mut a, b| {
|
||||
a.reserve(b.len());
|
||||
a.push_str(&b);
|
||||
a
|
||||
});
|
||||
|
||||
ItemBuilder::default()
|
||||
.title(Some(self.title))
|
||||
.pub_date(self.date.format(&Iso8601::<ISO8601_DATE>).ok())
|
||||
.link(Some(self.url.clone()))
|
||||
.description(Some(desc))
|
||||
.content(Some(content))
|
||||
.guid(Some(GuidBuilder::default().value(self.url).build()))
|
||||
.build()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue