Fixed SCG search
This commit is contained in:
parent
98a8040246
commit
017b768953
1 changed files with 6 additions and 1 deletions
|
|
@ -11,7 +11,8 @@ import (
|
||||||
const SCGURL = "http://www.starcitygames.com/results?name="
|
const SCGURL = "http://www.starcitygames.com/results?name="
|
||||||
|
|
||||||
func GetSCGPrices(name string) ([]CardPrice, error) {
|
func GetSCGPrices(name string) ([]CardPrice, error) {
|
||||||
url := getSCGUrl(name)
|
preprocessedName := preprocessNameForSearch(name)
|
||||||
|
url := getSCGUrl(preprocessedName)
|
||||||
doc, err := htmlquery.LoadURL(url)
|
doc, err := htmlquery.LoadURL(url)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
@ -19,6 +20,10 @@ func GetSCGPrices(name string) ([]CardPrice, error) {
|
||||||
return fetchPrices(doc)
|
return fetchPrices(doc)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func preprocessNameForSearch(name string) string {
|
||||||
|
return strings.Replace(name, "|", "", 1)
|
||||||
|
}
|
||||||
|
|
||||||
func fetchPrices(doc *html.Node) ([]CardPrice, error) {
|
func fetchPrices(doc *html.Node) ([]CardPrice, error) {
|
||||||
priceContainers := getPriceContainers(doc)
|
priceContainers := getPriceContainers(doc)
|
||||||
prices := make([]CardPrice, 0)
|
prices := make([]CardPrice, 0)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue