feat(sources): add managed RSS feeds (#41)
This commit is contained in:
@ -29,20 +29,21 @@ type Candidate struct {
|
||||
orderFrozen bool
|
||||
}
|
||||
type SourceStat struct {
|
||||
SourceKey string `json:"source_key"`
|
||||
ContentComplete int `json:"content_complete"`
|
||||
ContentIncomplete int `json:"content_incomplete"`
|
||||
ContentUnavailable int `json:"content_unavailable"`
|
||||
DatesAvailable int `json:"dates_available"`
|
||||
SourceID string `json:"source_id"`
|
||||
SourceType string `json:"source_type"`
|
||||
Status string `json:"status"`
|
||||
Candidates int `json:"candidates"`
|
||||
LayaSelected int `json:"laya_selected"`
|
||||
Selected int `json:"selected"`
|
||||
ArticleLimit int `json:"article_limit"`
|
||||
ContentFallbacks int `json:"content_fallbacks"`
|
||||
FailureCode string `json:"failure_code,omitempty"`
|
||||
Feeds *scraper.FeedCounts `json:"feeds,omitempty"`
|
||||
SourceKey string `json:"source_key"`
|
||||
ContentComplete int `json:"content_complete"`
|
||||
ContentIncomplete int `json:"content_incomplete"`
|
||||
ContentUnavailable int `json:"content_unavailable"`
|
||||
DatesAvailable int `json:"dates_available"`
|
||||
SourceID string `json:"source_id"`
|
||||
SourceType string `json:"source_type"`
|
||||
Status string `json:"status"`
|
||||
Candidates int `json:"candidates"`
|
||||
LayaSelected int `json:"laya_selected"`
|
||||
Selected int `json:"selected"`
|
||||
ArticleLimit int `json:"article_limit"`
|
||||
ContentFallbacks int `json:"content_fallbacks"`
|
||||
FailureCode string `json:"failure_code,omitempty"`
|
||||
}
|
||||
type GenerationOutcome struct {
|
||||
ContentComplete int `json:"content_complete"`
|
||||
@ -220,7 +221,17 @@ func (u *useCase) Generate(ctx context.Context, userID string) (Result, error) {
|
||||
if *source.SourceKey == models.SourceYahooFinance {
|
||||
sourceSymbols = yahooSymbols(input.Assets)
|
||||
}
|
||||
articles, err = feed.Scrape(ctx, append([]string(nil), sourceSymbols...))
|
||||
if reported, ok := feed.(scraper.ReportedScraper); ok {
|
||||
var counts scraper.FeedCounts
|
||||
articles, counts, err = reported.ScrapeWithDiagnostics(ctx, append([]string(nil), sourceSymbols...))
|
||||
stat.Feeds = &counts
|
||||
if counts.Failed > 0 && counts.Succeeded > 0 {
|
||||
stat.Status = "partial"
|
||||
partial = true
|
||||
}
|
||||
} else {
|
||||
articles, err = feed.Scrape(ctx, append([]string(nil), sourceSymbols...))
|
||||
}
|
||||
}
|
||||
if err != nil {
|
||||
stat.Status = "failed"
|
||||
|
||||
Reference in New Issue
Block a user