✨ Feed the full content flag to reduce web requests
This commit is contained in:
parent
fd0d3699e4
commit
fd9761f328
@ -12,7 +12,8 @@ type SubscriptionFeed struct {
|
|||||||
cruda.BaseModel
|
cruda.BaseModel
|
||||||
|
|
||||||
URL string `json:"url"`
|
URL string `json:"url"`
|
||||||
IsEnabled bool `json:"enabled"`
|
IsEnabled bool `json:"is_enabled"`
|
||||||
|
IsFullContent bool `json:"is_full_content"`
|
||||||
PullInterval int `json:"pull_interval"`
|
PullInterval int `json:"pull_interval"`
|
||||||
Adapter string `json:"adapter"`
|
Adapter string `json:"adapter"`
|
||||||
AccountID *uint `json:"account_id"`
|
AccountID *uint `json:"account_id"`
|
||||||
|
@ -183,12 +183,18 @@ func feedReadGuidedFeed(src models.SubscriptionFeed, eager ...bool) ([]models.Su
|
|||||||
parent.Thumbnail = item.Image.URL
|
parent.Thumbnail = item.Image.URL
|
||||||
}
|
}
|
||||||
|
|
||||||
article, err := ScrapSubscriptionItem(item.Link, parent)
|
// When the source enabled the full content,
|
||||||
if err != nil {
|
// It means the feed contains all the content, and we're not going to scrap it
|
||||||
log.Warn().Err(err).Str("url", item.Link).Msg("Failed to scrap a news article...")
|
if src.IsFullContent {
|
||||||
continue
|
result = append(result, pgConvert(parent))
|
||||||
|
} else {
|
||||||
|
article, err := ScrapSubscriptionItem(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