Hotfix. Added checking for nil subnodes

This commit is contained in:
Aryom Belousov 2020-11-10 13:11:18 +03:00
parent 53f872a72d
commit 8817bd521a
2 changed files with 7 additions and 3 deletions

View file

@ -16,6 +16,6 @@ deploy:
- docker login $REGISTRY_NAME -u $DOCKER_USER -p $DOCKER_PASSWORD
- docker push $IMAGE_NAME
- docker push $DOCKER_IMAGE_TAG
- "curl -X POST -H \"Authorization: Bearer $GOCD_ACCESS_TOKEN\" -d '{\"repository_url\": \"https://gitlab.com/flygrounder/go-mtg-vk.git\"}' http://165.22.85.27:8153/go/admin/materials/git/notify"
# - "curl -X POST -H \"Authorization: Bearer $GOCD_ACCESS_TOKEN\" -d '{\"repository_url\": \"https://gitlab.com/flygrounder/go-mtg-vk.git\"}' http://165.22.85.27:8153/go/admin/materials/git/notify"
only:
- master

View file

@ -43,9 +43,13 @@ func GetPricesScg(name string) ([]CardPrice, error) {
}
}
editionNode := htmlquery.FindOne(block, "//p[@class=\"hawk-results-item__category\"]/a")
price.Edition = editionNode.FirstChild.Data
if editionNode.FirstChild != nil {
price.Edition = editionNode.FirstChild.Data
}
priceNode := htmlquery.FindOne(block, "//div[contains(concat(' ',normalize-space(@class),' '),' hawk-results-item__options-table-cell--price ')]")
price.Price = priceNode.FirstChild.Data
if priceNode.FirstChild != nil {
price.Price = priceNode.FirstChild.Data
}
results = append(results, price)
}
return results, nil