Skip to content

Commit

Permalink
fix url encoding with developer data
Browse files Browse the repository at this point in the history
  • Loading branch information
LimJongDuk committed Aug 17, 2023
1 parent 62eba04 commit 347a497
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 4 deletions.
1 change: 1 addition & 0 deletions cmd/gpp/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ require (

require (
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/mattn/go-colorable v0.1.12 // indirect
github.com/mattn/go-isatty v0.0.14 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
Expand Down
1 change: 1 addition & 0 deletions cmd/gpp/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHH
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
github.com/mattn/go-colorable v0.1.12 h1:jF+Du6AlPIjs2BiUiQlKOX0rt3SujHxPnksPKZbaA40=
github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4=
github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y=
Expand Down
5 changes: 1 addition & 4 deletions go.work.sum
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/urfave/cli/v2 v2.25.1/go.mod h1:GHupkWPMM0M/sj1a2b4wUrWBPzazNrIjouW6fmdJLxc=
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8=
github.com/BurntSushi/toml v1.2.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
1 change: 1 addition & 0 deletions internal/scraper/app_method.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ func App(ctx context.Context, client sh.HTTPClient, spec models.ApplicationSpec)
}

app.Developer = strings.Split(app.Developer, "id=")[1]
app.Unquote()

return app.Assign(&models.App{AppID: spec.AppID, URL: requestURL}), nil
}
16 changes: 16 additions & 0 deletions models/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package models

import (
"fmt"
"net/url"

"github.com/bots-house/google-play-parser/internal/shared"
)
Expand Down Expand Up @@ -61,6 +62,21 @@ func (app *App) Assign(rhs *App) App {
return shared.Assign(app, rhs)
}

func (app *App) Unquote() {
developer, err := url.QueryUnescape(app.Developer)
if err != nil {
developer = app.Developer
}

developerID, err := url.QueryUnescape(app.DeveloperID)
if err != nil {
developerID = app.DeveloperID
}

app.Developer = developer
app.DeveloperID = developerID
}

type ApplicationSpec struct {
AppID string
Lang string
Expand Down

0 comments on commit 347a497

Please sign in to comment.