fix channel item links with its data type

This commit is contained in:
yggverse 2026-01-07 19:17:47 +02:00
parent c0734731cb
commit 259ac118dc

View file

@ -90,14 +90,14 @@ fn crawl(db: &mut Mysql, channel_config: &config::Channel) -> Result<()> {
for channel_item in channel_items.iter().take(channel_items_limit) { for channel_item in channel_items.iter().take(channel_items_limit) {
let guid = match channel_item.guid { let guid = match channel_item.guid {
Some(ref guid) => guid.value.clone(), Some(ref guid) => guid.value.as_ref(),
None => { None => {
warn!("Undefined `guid` field in `{channel_url}`"); warn!("Undefined `guid` field in `{channel_url}`");
continue; continue;
} }
}; };
let link = match channel_item.guid { let link = match channel_item.link {
Some(ref link) => link.value.clone(), Some(ref link) => link,
None => { None => {
warn!("Undefined `link` field in `{channel_url}`"); warn!("Undefined `link` field in `{channel_url}`");
continue; continue;
@ -117,15 +117,15 @@ fn crawl(db: &mut Mysql, channel_config: &config::Channel) -> Result<()> {
} }
}; };
let channel_item_id = match db let channel_item_id = match db
.channel_items_by_channel_id_guid(channel_id, &guid, Some(1))? .channel_items_by_channel_id_guid(channel_id, guid, Some(1))?
.first() .first()
{ {
Some(result) => result.channel_item_id, Some(result) => result.channel_item_id,
None => db.insert_channel_item( None => db.insert_channel_item(
channel_id, channel_id,
pub_date, pub_date,
&guid, guid,
&link, link,
if channel_config.persist_item_title { if channel_config.persist_item_title {
channel_item.title() channel_item.title()
} else { } else {
@ -142,7 +142,7 @@ fn crawl(db: &mut Mysql, channel_config: &config::Channel) -> Result<()> {
// preload remote content // preload remote content
let title = match channel_config.content_title_selector { let title = match channel_config.content_title_selector {
Some(ref selector) => match scrape(&link, selector) { Some(ref selector) => match scrape(link, selector) {
Ok(value) => match value { Ok(value) => match value {
Some(title) => title, Some(title) => title,
None => { None => {
@ -166,7 +166,7 @@ fn crawl(db: &mut Mysql, channel_config: &config::Channel) -> Result<()> {
}, },
}; };
let description = match channel_config.content_description_selector { let description = match channel_config.content_description_selector {
Some(ref selector) => match scrape(&link, selector) { Some(ref selector) => match scrape(link, selector) {
Ok(value) => match value { Ok(value) => match value {
Some(description) => description, Some(description) => description,
None => { None => {