👔 Scrap the website according the feed whatever it provide content or not
This commit is contained in:
parent
01b0cbce3e
commit
fbbe72bd54
@ -145,18 +145,13 @@ func newsSourceReadFeed(src models.NewsSource) ([]models.NewsArticle, error) {
|
|||||||
if item.Image != nil {
|
if item.Image != nil {
|
||||||
parent.Thumbnail = item.Image.URL
|
parent.Thumbnail = item.Image.URL
|
||||||
}
|
}
|
||||||
if len(item.Content) > 0 {
|
|
||||||
// Good website, provide content, skip scraping of it
|
article, err := ScrapNews(item.Link, parent)
|
||||||
parent.Content = item.Content
|
if err != nil {
|
||||||
result = append(result, pgConvert(parent))
|
log.Warn().Err(err).Str("url", item.Link).Msg("Failed to scrap a news article...")
|
||||||
} else {
|
continue
|
||||||
article, err := ScrapNews(item.Link, parent)
|
|
||||||
if err != nil {
|
|
||||||
log.Warn().Err(err).Str("url", item.Link).Msg("Failed to scrap a news article...")
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
result = append(result, pgConvert(*article))
|
|
||||||
}
|
}
|
||||||
|
result = append(result, pgConvert(*article))
|
||||||
|
|
||||||
log.Debug().Str("url", item.Link).Msg("Scraped a news article...")
|
log.Debug().Str("url", item.Link).Msg("Scraped a news article...")
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user