fix(scraper): verify complete article evidence (#40)

This commit is contained in:
2026-11-24 19:24:29 +01:00
parent 70ffe41cfb
commit a55dc2e189
27 changed files with 833 additions and 132 deletions

View File

@ -3,6 +3,7 @@ package yahoofinance
import (
"context"
"encoding/xml"
"errors"
"fmt"
"net/http"
"strings"
@ -37,6 +38,7 @@ type rssFeed struct {
func (y *YahooFinance) Scrape(ctx context.Context, symbols []string) ([]scraper.Article, error) {
var articles []scraper.Article
reachable := false
for i, symbol := range symbols {
if i > 0 {
@ -50,8 +52,12 @@ func (y *YahooFinance) Scrape(ctx context.Context, symbols []string) ([]scraper.
if err != nil {
continue
}
reachable = true
articles = append(articles, items...)
}
if len(symbols) > 0 && !reachable {
return nil, errors.New("yahoofinance: source unavailable")
}
return articles, nil
}