HeroicGamesLauncher icon indicating copy to clipboard operation
HeroicGamesLauncher copied to clipboard

EpicGames Store URL generation is not always correct

Open arielj opened this issue 2 years ago • 2 comments

Describe the bug

We are not getting the actual url for the store page of epic games so we are using some code to generate it using the game's title.

This is not always correct though, one example:

https://store.epicgames.com/en-US/p/batman-arkham-asylum <- when navigating using the store https://www.epicgames.com/store/product/batman-arkham-asylum-game-of-the-year-edition <- url generated with the game's title

The domain, store, product and language are not relevant (but maybe it's worth to update the generated url anyway, though the language is not really needed), but the name of the game, in this case, shouldn't have the game-of-the-year-edition substring

Add logs

Not relevant

Steps to reproduce

  1. You must own Batman™ Arkham Asylum Game of the Year Edition
  2. Click on the game details
  3. Go to Tools
  4. Click on Store Page

the epic store page will show a 404 error

Expected behavior

The id in the url for that game should be batman-arkham-asylum.

This probably applies to other games too with different problems. For example Among the Sleep - Enhanced Edition's generated url is https://www.epicgames.com/store/product/among-the-sleep--enhanced-edition while the correct url is https://store.epicgames.com/en-US/p/among-the-sleep-enhanced-edition (single dash between sleep and enhanced)

Screenshots

No response

System Information

Not relevant

Additional information

No response

arielj avatar Mar 25 '22 19:03 arielj

I was checking epic store and the metadata that we get from epic for different games and there's no clear pattern to follow here. Some games include the suffixes like enhanced-edition in the url, some don't for example. There's no consistent pattern and the metadata has no information about that either.

For the game of the year suffix I saw all games ignoring that part of the name (GOTY, Game of the Year Edition, and variants). There aren't that many games in the epic store with game of the year in the names so it was easy to check.

arielj avatar Mar 28 '22 15:03 arielj

Maybe a workaround is to use the endpoint epic uses for the search functionality in the website? that way we can do a request searching for the complete name of the game and then pick the slug from there, like...

curl 'https://store.epicgames.com/graphql?operationName=primarySearchAutocomplete&variables=%7B%22keywords%22:%22Among+the+Sleep%22%7D&extensions=%7B%22persistedQuery%22:%7B%22version%22:1,%22sha256Hash%22:%22531ca97218358754b2a3dade40dbbfc62e280d0173dcaf53305b3b3f3c393580%22%7D%7D'

returns a json object and there's the slug for that game

{"data":{"Catalog":{"searchStore":{"elements":[{"countriesBlacklist":null,"countriesWhitelist":null,"customAttributes":[{"key":"com.epicgames.app.blacklist","value":"[]"},{"key":"publisherName","value":"Krillbite Studio AS"},{"key":"developerName","value":"Krillbite Studio AS"},{"key":"com.epicgames.app.productSlug","value":"among-the-sleep-enhanced-edition"}],"isCodeRedemptionOnly":false,"offerId":"2a112cd37b774426990583a259e25ef9","sandboxId":"53ef2f4592684c4c97d6d32e40467274"}],"paging":{"total":1}}}},"extensions":{}}

and

curl 'https://store.epicgames.com/graphql?operationName=primarySearchAutocomplete&variables=%7B%22keywords%22:%22Batman+Arkham+Asylum+Game+of+the+Year+Edition%22%7D&extensions=%7B%22persistedQuery%22:%7B%22version%22:1,%22sha256Hash%22:%22531ca97218358754b2a3dade40dbbfc62e280d0173dcaf53305b3b3f3c393580%22%7D%7D'

returns the slug for the batman game:

{"data":{"Catalog":{"searchStore":{"elements":[{"countriesBlacklist":["RU","BY"],"countriesWhitelist":null,"customAttributes":[{"key":"com.epicgames.app.blacklist","value":"{}"},{"key":"publisherName","value":"Warner Bros."},{"key":"developerName","value":"Rocksteady Studios"},{"key":"com.epicgames.app.productSlug","value":"batman-arkham-asylum/home"}],"isCodeRedemptionOnly":false,"offerId":"0f96082fc0b8475db86cba86c8b6a796","sandboxId":"5f7c811695f14b8fa3a8e1ea35713d23"},{"countriesBlacklist":null,"countriesWhitelist":null,"customAttributes":[{"key":"com.epicgames.app.weight","value":"8411"},{"key":"com.epicgames.app.offerNs","value":"5f7c811695f14b8fa3a8e1ea35713d23"},{"key":"com.epicgames.app.blacklist","value":"{}"},{"key":"com.epicgames.app.productSlug","value":"batman-arkham-asylum/home"},{"key":"com.epicgames.app.offerId","value":"0f96082fc0b8475db86cba86c8b6a796"}],"isCodeRedemptionOnly":true,"offerId":"ac3da74961c8413b9a63b4258cbc31f8","sandboxId":"epic"}],"paging":{"total":2}}}},"extensions":{}}

thought it has a /home at the end, not sure if that's common, and I don't know if there's a better graphql query to use to just get the slug based on a game id or something not that hacky

arielj avatar Mar 28 '22 15:03 arielj

fixed in the main branch

arielj avatar Jan 27 '23 13:01 arielj