diff --git a/cardsinfo/scgprices.go b/cardsinfo/scgprices.go index d56be58..7193f04 100644 --- a/cardsinfo/scgprices.go +++ b/cardsinfo/scgprices.go @@ -11,7 +11,8 @@ import ( const SCGURL = "http://www.starcitygames.com/results?name=" func GetSCGPrices(name string) ([]CardPrice, error) { - url := getSCGUrl(name) + preprocessedName := preprocessNameForSearch(name) + url := getSCGUrl(preprocessedName) doc, err := htmlquery.LoadURL(url) if err != nil { return nil, err @@ -19,6 +20,10 @@ func GetSCGPrices(name string) ([]CardPrice, error) { return fetchPrices(doc) } +func preprocessNameForSearch(name string) string { + return strings.Replace(name, "|", "", 1) +} + func fetchPrices(doc *html.Node) ([]CardPrice, error) { priceContainers := getPriceContainers(doc) prices := make([]CardPrice, 0)