mirror of
https://github.com/Dvorinka/facr-scraper.git
synced 2026-06-04 04:22:56 +00:00
facr link
This commit is contained in:
@@ -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)
|
||||||
@@ -1134,33 +1137,34 @@ func extractUUIDFromHref(href string) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Match struct {
|
type Match struct {
|
||||||
DateTime string `json:"date_time"`
|
DateTime string `json:"date_time"`
|
||||||
Home string `json:"home"`
|
Home string `json:"home"`
|
||||||
HomeID string `json:"home_id,omitempty"`
|
HomeID string `json:"home_id,omitempty"`
|
||||||
HomeLogoURL string `json:"home_logo_url,omitempty"`
|
HomeLogoURL string `json:"home_logo_url,omitempty"`
|
||||||
Away string `json:"away"`
|
Away string `json:"away"`
|
||||||
AwayID string `json:"away_id,omitempty"`
|
AwayID string `json:"away_id,omitempty"`
|
||||||
AwayLogoURL string `json:"away_logo_url,omitempty"`
|
AwayLogoURL string `json:"away_logo_url,omitempty"`
|
||||||
Score string `json:"score"`
|
Score string `json:"score"`
|
||||||
Venue string `json:"venue"`
|
Venue string `json:"venue"`
|
||||||
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"`
|
||||||
DelegationURL string `json:"delegation_url,omitempty"`
|
FACRLink string `json:"facr_link,omitempty"`
|
||||||
|
DelegationURL string `json:"delegation_url,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// TableRow represents one row in a standings table
|
// TableRow represents one row in a standings table
|
||||||
type TableRow struct {
|
type TableRow struct {
|
||||||
Rank string `json:"rank"`
|
Rank string `json:"rank"`
|
||||||
Team string `json:"team"`
|
Team string `json:"team"`
|
||||||
TeamID string `json:"team_id,omitempty"`
|
TeamID string `json:"team_id,omitempty"`
|
||||||
TeamLogoURL string `json:"team_logo_url,omitempty"`
|
TeamLogoURL string `json:"team_logo_url,omitempty"`
|
||||||
Played string `json:"played"`
|
Played string `json:"played"`
|
||||||
Wins string `json:"wins"`
|
Wins string `json:"wins"`
|
||||||
Draws string `json:"draws"`
|
Draws string `json:"draws"`
|
||||||
Losses string `json:"losses"`
|
Losses string `json:"losses"`
|
||||||
Score string `json:"score"`
|
Score string `json:"score"`
|
||||||
Points string `json:"points"`
|
Points string `json:"points"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// resolveISURL makes relative IS links absolute against https://is.fotbal.cz/public/
|
// resolveISURL makes relative IS links absolute against https://is.fotbal.cz/public/
|
||||||
|
|||||||
Reference in New Issue
Block a user