GithubHelp home page GithubHelp logo

auropick / epic-free-games Goto Github PK

View Code? Open in Web Editor NEW
45.0 2.0 4.0 149 KB

Wrapper to getting weekly free games with Epic Games API

Home Page: https://www.npmjs.com/package/epic-free-games

License: MIT License

TypeScript 100.00%
epic-games free epic free-games games epic-free-games typescript axios wrapper js

epic-free-games's Introduction

Epic Games Free Games

GitHub npm npm

Get Weekly Free Games Of Epic Games

Installation

npm i epic-free-games

// OR

yarn add epic-free-games

Usage

const { EpicFreeGames } = require('epic-free-games');

// OR

import { EpicFreeGames } from 'epic-free-games';

const epicFreeGames = new EpicFreeGames({ country: 'JP', locale: 'ja', includeAll: true })

epicFreeGames.getGames().then(res => {
  // Do something
}).catch(err => {
  // Do something
});

// you can override default options
epicFreeGames.getGames({ country: 'DE', locale: 'de', includeAll: false }).then(res => {
  // Do something
}).catch(err => {
  // Do something
});

Function Parameters

Function Parameter Parameter Values Default Value
getGames country: string "TR", "US", "GB", "DE", "AR", "ES", "MX", "FR", "IT", "JP", "KR", "PL", "BR", "RU", "TH", "CN", "IN", "GR" "US"
getGames locale: string "tr", "ja", "ar", "de", "en-US", "es-ES", "es-MX", "fr", "it", "ko", "pl", "pt-BR", "ru", "th", "zh-CN", "zh-Hant" "en-US"
getGames includeAll: boolean true | false false

Sample Output

{
  currentGames: [
    {
      title: '3 out of 10: Season Two',
      id: '9fc33e99abf342138323856854e745ec',
      namespace: 'b829cfd910554ad3ad2eb3b314e2b1ef',
      description: '3 out of 10: Season Two',
      effectiveDate: '2021-04-08T15:00:00.000Z',
      offerType: 'BASE_GAME',
      expiryDate: null,
      status: 'ACTIVE',
      isCodeRedemptionOnly: false,
      keyImages: [Array],
      seller: [Object],
      productSlug: '3-out-of-10-season-2',
      urlSlug: 'mooncakegeneralaudience',
      url: null,
      items: [Array],
      customAttributes: [Array],
      categories: [Array],
      tags: [Array],
      price: [Object],
      promotions: [Object]
    }
  ],
  nextGames: [
    {
      title: "Ken Follett's The Pillars of the Earth",
      id: 'ded5930173d5495993186871fbfd329a',
      namespace: 'ce8393adfbf342ceab0a36479ffbc627',
      description: "Ken Follett's The Pillars of the Earth",
      effectiveDate: '2021-04-15T15:00:00.000Z',
      offerType: 'BASE_GAME',
      expiryDate: null,
      status: 'ACTIVE',
      isCodeRedemptionOnly: false,
      keyImages: [Array],
      seller: [Object],
      productSlug: 'ken-follets-the-pillars-of-the-earth',
      urlSlug: 'tiger-general-audience',
      url: null,
      items: [Array],
      customAttributes: [Array],
      categories: [Array],
      tags: [Array],
      price: [Object],
      promotions: [Object]
    },
    {
      title: 'Deponia: The Complete Journey',
      id: 'abdae4ebcf3e41beb6ec8040d818afcd',
      namespace: 'e5decf71f325458b92653616ee98682a',
      description: 'Deponia: The Complete Journey',
      effectiveDate: '2021-04-15T15:00:00.000Z',
      offerType: 'BASE_GAME',
      expiryDate: null,
      status: 'ACTIVE',
      isCodeRedemptionOnly: false,
      keyImages: [Array],
      seller: [Object],
      productSlug: 'deponia-the-complete-journey',
      urlSlug: 'ghoulgeneralaudience',
      url: null,
      items: [Array],
      customAttributes: [Array],
      categories: [Array],
      tags: [Array],
      price: [Object],
      promotions: [Object]
    },
    {
      title: 'The First Tree',
      id: '844f72b164ad4f5884c4feeca5561678',
      namespace: '489c2ca47aaa4190b694184b979d3b23',
      description: 'The First Tree',
      effectiveDate: '2021-04-15T15:00:00.000Z',
      offerType: 'BASE_GAME',
      expiryDate: null,
      status: 'ACTIVE',
      isCodeRedemptionOnly: false,
      keyImages: [Array],
      seller: [Object],
      productSlug: 'the-first-tree',
      urlSlug: 'the-first-tree',
      url: null,
      items: [Array],
      customAttributes: [Array],
      categories: [Array],
      tags: [Array],
      price: [Object],
      promotions: [Object]
    }
  ]
}

If you have any questions please do not hesitate to contact me.


If you want to support me, you can give a star. That makes me happy.

epic-free-games's People

Contributors

auropick avatar souvlaki42 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

epic-free-games's Issues

"Failed to challenge captcha, please try again later"

Hi there,

first of all, thanks for this wonderful tool! It's been working great for the past few months.
However, recently (the past 2 weeks, maybe 3) I have been unable to successfully resolve a captcha request from this script and have had to claim my games manually via the epic client each week.

  • I'm running this in a docker container on my Unraid box.

  • The container is surfaced to the outside world via reverse proxy (nginx) and SSL cert via letsencrypt (swag docker container)

  • I have notifications setup to both Discord and a HTTPS webhook attached to home assistant.

  • I'm in Australia and typically receive a captcha request every Friday morning when the script runs to check for this week's free game.

  • Everything about the process works the same as it always has - the puppeteer portal appears to work fine, I get prompted with the captcha and resolve it, click proceed and then am presented with the Epic Store "checkout" page, and an error "Failed to challenge captcha, please try again later" in red. (attached image)
    image

  • I've tried actioning the request on my phone and desktop - same results.

  • I haven't changed anything to do with this docker, my reverse proxy, or related systems that would've caused this, afaik.

I hope I've provided enough information. Thanks in advance.

Best,

Joshua

Expiry Date

Love the work, using it in my Discord bot as we speak!

Is there anyway of getting the date the offers expire? Looking at it I know you can usee the nexts effectiveDate but as of right now I'm not getting anything returned there.

Thanks a lot :)

Game URL

Heya, I have a question. How would I get url to the game?
I have tried using res.currentGames[i].productSlug and res.currentGames[i].customAttributes[2].value but then I have realized not every game has that value which I can use in the url. Am I missing something or? Thanks

Support other countries

Hi,

I am wondering why are we limiting the country enum to the selected few only? Are there different schemas for different countries?

Help

hey i was trying use api but just get undefined, and [ Object ]
can you add me in discord to help plz? GosT#2274

NextGame Error

Hi,

The next game returns a empty array while there is a next game coming up.

Array "currentGames" empty

Hi, I just found out this module to get weekly free Epic games. I just ran it and the first thing I noticed was the array currentGames[] empty. Right now, 2022-06-15 a game called "ManEater" is on the store for free and will expire tomorrow. In fact, the next game is called "Supraland" and it is in the nextGames[] array.

This is the code I used: console.log(await getGames("IT")); I'm currently on Typescript project. Here is the JSON resulting.

image

Request failed with status code 404

After updating today's games, any search you run with any region the API returns this error, I was making a command yesterday and it was working, then today after updating this week's new games it gave me this

Erro: Error: An error occurred
         error: {
       "message": "CatalogOffer/offerMappings: Request failed with status code 404",
       "locations": [
               {}
       ],
       "correlationId": "1792c500-beb8-4854-9d69-43e4a9a30e54",
       "serviceResponse": "{\"errorMessage\":\"The item or resource being requested could not be found.\",\"errorCode\":\"errors.com.epicgames.not_found\",\"numericErrorCode\":1004,\"errorStatus\":404}",
       "stack": null,
       "path": [
               "Catalog",
               "searchStore",
               "elements",
               3,
               "offerMappings"
       ]
 },{
       "message": "CatalogNamespace/mappings: Request failed with status code 404",
       "locations": [
               {}
       ],
       "correlationId": "1792c500-beb8-4854-9d69-43e4a9a30e54",
       "serviceResponse": "{\"errorMessage\":\"The item or resource being requested could not be found.\",\"errorCode\":\"errors.com.epicgames.not_found\",\"numericErrorCode\":1004,\"errorStatus\":404}",
       "stack": null,
       "path": [
               "Catalog",
               "searchStore",
               "elements",
               3,
               "catalogNs",
               "mappings"
       ]
 }

Empty array Nexts

The array returns empty for the nexts game(s), while the game that is upcoming is under current already.
How can I fix that ?

Custom query parameters

Could you make ability to add custom query params such as locale and allowCountries (it's used by epic frontend)?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.