Skip to content

Commit

Permalink
Merge pull request #179 from algo7/fix/scraper_location_id_integer_co…
Browse files Browse the repository at this point in the history
…nversion

Fix location ID parsing in TripAdvisor scraper
  • Loading branch information
algo7 authored Jan 23, 2024
2 parents 0681250 + b6da21a commit 536890a
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions scraper/pkg/tripadvisor/tripadvisor.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ func ParseURL(url string, locationType string) (locationID uint32, locationName
urlSplit := strings.Split(url, "-")

// Trim the d from the location ID
locationID, err := strconv.Atoi(strings.TrimLeft(urlSplit[3], "d"))
locationID, err := strconv.ParseUint(strings.TrimLeft(urlSplit[3], "d"), 10, 32)
if err != nil {
return 0, "", fmt.Errorf("Error parsing location ID: %w", err)
}
Expand All @@ -224,8 +224,7 @@ func ParseURL(url string, locationType string) (locationID uint32, locationName
case "AIRLINE":

urlSplit := strings.Split(url, "-")

locationID, err := strconv.Atoi(strings.TrimLeft(urlSplit[1], "d"))
locationID, err := strconv.ParseUint(strings.TrimLeft(urlSplit[1], "d"), 10, 32)
if err != nil {
return 0, "", fmt.Errorf("Error parsing location ID: %w", err)
}
Expand Down

0 comments on commit 536890a

Please sign in to comment.