facr link

This commit is contained in:
Tomáš Dvořák
2025-08-26 08:36:11 +02:00
parent 0c76824775
commit 8ea7df2410
+5 -1
View File
@@ -197,6 +197,7 @@ func parseCompetitionMatchesFromFotbal(pageURL, clubType, clubName, clubID strin
Venue: venue, Venue: venue,
MatchID: matchID, MatchID: matchID,
ReportURL: reportURL, ReportURL: reportURL,
FACRLink: reportURL,
}) })
}) })
return matches return matches
@@ -288,6 +289,8 @@ func parseCompetitionMatchesFromIS(detailURL, clubType, clubName, clubID string)
reportURL = fmt.Sprintf("https://www.fotbal.cz/souteze/zapasy/zapas/%s", matchID) reportURL = fmt.Sprintf("https://www.fotbal.cz/souteze/zapasy/zapas/%s", matchID)
} }
} }
// Canonical fotbal.cz link
facrLink := reportURL
// Filter by club involvement: prefer UUID match, fallback to name matching with simplified token // Filter by club involvement: prefer UUID match, fallback to name matching with simplified token
if clubName != "" || clubID != "" { if clubName != "" || clubID != "" {
involved := false involved := false
@@ -321,7 +324,7 @@ func parseCompetitionMatchesFromIS(detailURL, clubType, clubName, clubID string)
} }
homeLogo := getLogo(rawHome, homeID) homeLogo := getLogo(rawHome, homeID)
awayLogo := getLogo(rawAway, awayID) awayLogo := getLogo(rawAway, awayID)
matches = append(matches, Match{DateTime: dt, Home: rawHome, HomeID: homeID, HomeLogoURL: homeLogo, Away: rawAway, AwayID: awayID, AwayLogoURL: awayLogo, Score: score, Venue: venue, MatchID: matchID, ReportURL: func() string { if isReportHref != "" { return isReportHref }; return reportURL }(), DelegationURL: isDelegHref}) matches = append(matches, Match{DateTime: dt, Home: rawHome, HomeID: homeID, HomeLogoURL: homeLogo, Away: rawAway, AwayID: awayID, AwayLogoURL: awayLogo, Score: score, Venue: venue, MatchID: matchID, ReportURL: func() string { if isReportHref != "" { return isReportHref }; return reportURL }(), FACRLink: facrLink, DelegationURL: isDelegHref})
}) })
if os.Getenv("DEBUG_SAVE_HTML") != "" { if os.Getenv("DEBUG_SAVE_HTML") != "" {
log.Printf("IS parse summary for %s: total rows=%d, kept=%d", detailURL, totalRows, keptRows) log.Printf("IS parse summary for %s: total rows=%d, kept=%d", detailURL, totalRows, keptRows)
@@ -1146,6 +1149,7 @@ type Match struct {
Note string `json:"note,omitempty"` Note string `json:"note,omitempty"`
MatchID string `json:"match_id"` MatchID string `json:"match_id"`
ReportURL string `json:"report_url,omitempty"` ReportURL string `json:"report_url,omitempty"`
FACRLink string `json:"facr_link,omitempty"`
DelegationURL string `json:"delegation_url,omitempty"` DelegationURL string `json:"delegation_url,omitempty"`
} }