epicgames-freegames-node icon indicating copy to clipboard operation
epicgames-freegames-node copied to clipboard

Suggestion - add other free games to script

Open Andrej730 opened this issue 5 years ago • 9 comments
trafficstars

It seems that EGS sometimes has some other free games to offer. This week it is https://www.epicgames.com/store/en-US/product/sludge-life/home (it is shown at the https://www.epicgames.com/store/en-US/free-games ) My suggestion is to include them in script.

Andrej730 avatar Jun 27 '20 17:06 Andrej730

Same for https://www.epicgames.com/store/fr/product/a-total-war-saga-troy/home which is 24h free.

bagage avatar Aug 13 '20 14:08 bagage

I did some digging on this a while back, and I found a GraphQL query that can list all games from the backend with their promotional offers. The issue is that there's 2000 games, which is about 1MB of data. I have very little experience with GraphQL, but I'd like to find a way to filter by discount amount so we don't have a huge request that we have to filter through.

If anyone wants to mess around with it, here's the query:

curl --location --request POST 'https://www.epicgames.com/store/backend/graphql-proxy' \
--header 'Content-Type: application/json' \
--data-raw '{"query":"query searchStoreQuery($allowCountries: String, $category: String, $count: Int, $country: String!, $keywords: String, $locale: String, $namespace: String, $sortBy: String, $sortDir: String, $start: Int, $tag: String) {\r\n  Catalog {\r\n    searchStore(allowCountries: $allowCountries, category: $category, count: $count, country: $country, keywords: $keywords, locale: $locale, namespace: $namespace, sortBy: $sortBy, sortDir: $sortDir, start: $start, tag: $tag\r\n    ) {\r\n      elements {\r\n        title\r\n        id\r\n        namespace\r\n        description\r\n        productSlug\r\n        items {\r\n          id\r\n          namespace\r\n        }\r\n        promotions(category: $category) {\r\n          promotionalOffers {\r\n            promotionalOffers {\r\n              startDate\r\n              endDate\r\n              discountSetting {\r\n                discountType\r\n                discountPercentage\r\n              }\r\n            }\r\n          }\r\n        }\r\n      }\r\n      paging {\r\n        count\r\n        total\r\n      }\r\n    }\r\n  }\r\n}","variables":{"category":"games","sortBy":"effectiveDate","sortDir":"asc","count":1000,"country":"US","allowCountries":"US","locale":"en-US","start":0}}'

claabs avatar Aug 13 '20 16:08 claabs

It's seems script doesn't see 2 out of 5 currently available free games:

  • https://www.epicgames.com/store/en-US/product/3-out-of-10-ep-3/home
  • https://www.epicgames.com/store/en-US/product/thimbleweed-park/delores

Andrej730 avatar Aug 21 '20 06:08 Andrej730

My thought was that the script should redeem the games that are temporarily free. Thimbleweed and 3/10 Ep 3 appear to be free forever. I'm worried that if it redeems all free games, it could get out of hand (e.g. the thousands of free games on Steam).

I can add a variable to redeem all free games no matter what.

claabs avatar Aug 21 '20 14:08 claabs

It would be nice option to have. I had the script that was redeeming all free games on steam and it was a mess because it was redeeming all kind of useless stuff - like game trailers, demo-versions etc. Hopefully on EGS there is a way to filter out only actual games and activating all free games would not be that messy.

Andrej730 avatar Aug 22 '20 09:08 Andrej730

@claabs This game is not being purchased. It doesn't appear to always be free so I'm not sure what the deal is. I'd be happy to try to help figure it out if you want.

https://www.epicgames.com/store/en-US/p/godfall--challenger-edition

Banner-Keith avatar Dec 15 '21 19:12 Banner-Keith

@claabs This game is not being purchased. It doesn't appear to always be free so I'm not sure what the deal is. I'd be happy to try to help figure it out if you want.

https://www.epicgames.com/store/en-US/p/godfall--challenger-edition

This was due to captchas being added recently. It was already fixed in #192. Pull the latest image for the fix.

claabs avatar Dec 15 '21 19:12 claabs

I'll give that a shot thank you.

Banner-Keith avatar Dec 15 '21 20:12 Banner-Keith

It did end up purchasing Prison Architect properly by sending me the captcha, but this game isn't showing up at all.

I have hcaptcha commented out right now since that is not working.

[2021-12-15 12:47:40.126 -0700] INFO (43 on epicgames-freegames): Available free games
user: "[email protected]"
availableGames: [
"Prison Architect"
]
[2021-12-15 12:47:40.574 -0700] INFO (43 on epicgames-freegames): Unpurchased free games
user: "[email protected]"
purchasableGames: [
"Prison Architect"
]
[2021-12-15 12:47:40.574 -0700] INFO (43 on epicgames-freegames): Purchasing Prison Architect
[2021-12-15 12:47:42.913 -0700] WARN (HTTPError/43 on epicgames-freegames): Response code 400 (Bad Request)
HTTPError: Response code 400 (Bad Request)
at Request.<anonymous> (/usr/app/node_modules/got/dist/source/as-promise/index.js:117:42)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
[2021-12-15 12:47:42.913 -0700] WARN (43 on epicgames-freegames): API purchase experienced an error, trying puppeteer purchase

[2021-12-15 12:47:42.914 -0700] WARN (43 on epicgames-freegames): hcaptchaAccessibilityUrl not configured, captchas are less likely to be bypassed. Follow this guide to set it up: https://github.com/claabs/epicgames-freegames-node#hcaptcha-accessibility-cookies
[2021-12-15 12:47:52.229 -0700] INFO (43 on epicgames-freegames): Go to this URL and do something
user: "[email protected]"
url: "http://epicgames-freegames.myinternalnetwork.internal:3000/?targetId=16CC67453F21673C1893209AE86BE403"
[2021-12-15 12:48:21.484 -0700] INFO (43 on epicgames-freegames): Done purchasing Prison Architect

I restarted it to force it to run

[2021-12-15 13:02:19.760 -0700] INFO (43 on epicgames-freegames): Checking free games for [email protected]
[2021-12-15 13:02:27.507 -0700] INFO (43 on epicgames-freegames): Successfully refreshed login
user: "[email protected]"
[2021-12-15 13:02:28.154 -0700] INFO (43 on epicgames-freegames): Available free games
user: "[email protected]"
availableGames: [
"Prison Architect"
]
[2021-12-15 13:02:28.626 -0700] INFO (43 on epicgames-freegames): Unpurchased free games
user: "[email protected]"
purchasableGames: []

Banner-Keith avatar Dec 15 '21 20:12 Banner-Keith

This was implemented a while back. Closing now.

claabs avatar Feb 15 '24 01:02 claabs