adds scraper for game search
This commit is contained in:
parent
40b3be7a11
commit
3ece55dfe4
3 changed files with 153 additions and 5 deletions
|
@ -17,7 +17,7 @@ type GogStruct struct {
|
|||
|
||||
func NewGogApi() GogStruct {
|
||||
gog := GogStruct{
|
||||
url: "https://www.gog.com/",
|
||||
url: "https://www.gog.com/en/games?priceRange=0,0&discounted=true",
|
||||
baseUrl: "https://www.gog.com/game/",
|
||||
idPrefix: "gog-",
|
||||
headers: make(map[string]string),
|
||||
|
@ -67,11 +67,11 @@ func (e GogStruct) Load() error {
|
|||
continue
|
||||
}
|
||||
for _, a := range t.Attr {
|
||||
if !(a.Key == "id" && a.Val == "giveaway") {
|
||||
if !(a.Key == "class" && a.Val == "product-tile product-tile--grid") {
|
||||
continue
|
||||
}
|
||||
for _, attr := range t.Attr {
|
||||
if attr.Key != "ng-href" {
|
||||
if attr.Key != "href" {
|
||||
continue
|
||||
}
|
||||
appID := regexAppid.FindStringSubmatch(attr.Val)
|
||||
|
@ -116,7 +116,7 @@ func (e GogStruct) Load() error {
|
|||
}
|
||||
for _, a := range t.Attr {
|
||||
if !(a.Key == "class" && a.Val == "productcard-basics__title") {
|
||||
|
||||
continue
|
||||
}
|
||||
if tt = bodyGame.Next(); tt != html.TextToken {
|
||||
continue
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue