Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Public API #20

Open
Infinitay opened this issue Dec 14, 2022 · 3 comments
Open

Public API #20

Infinitay opened this issue Dec 14, 2022 · 3 comments

Comments

@Infinitay
Copy link

Would you be open to providing a public API? It would make it so much easier to keep track of accounts via Google Sheets and you also handle the caching if I'm not mistaken from a brief skim through the code.

@bricefrisco
Copy link
Owner

bricefrisco commented Dec 15, 2022

I could expose a public API, but it would only be for the name list.

There is already an official Riot API for summoner names, the docs are here:
https://developer.riotgames.com/apis#summoner-v4/GET_getBySummonerName

This endpoint returns a revisionDate, which I then feed into this function, calcAvailabilityDate:
https://github.com/bricefrisco/NamesLoL/blob/master/src/libs/mapper.ts#L6

An API for an individual summoner name could be simplified to the following, hopefully this helps:

const fetchExpirationDate = async (name, token) => {
  const res = await fetch(`https://na1.api.riotgames.com/lol/summoner/v4/summoners/by-name/${name}`, {
      headers: {
        'X-Riot-Token': token
      }
  });

  const { revisionDate, summonerLevel } = await res.json();
  const nameDecayInMonths = Math.min(30, Math.max(6, summonerLevel));

  const expirationDate = new Date(revisionDate);
  expirationDate.setMonth(expirationDate.getMonth() + nameDecayInMonths);
  return expirationDate;
}

@Infinitay
Copy link
Author

Infinitay commented Dec 19, 2022

Oh I wasn't aware their API was available so readily, I should have done a Google Search before requesting you to make your API public. I'll go ahead and do this. Thank you.

EDIT: Oh, completely missed the development key is temporary for 24 hours and you still need to apply which I wasn't trying to deal with. Although I suppose I have no option but to wait to apply after Jan 3rd (they suspended apps).

Also, personally I was more interested in using your endpoint for specific names, but having your name list would not be a bad idea.

Side note, what are your thoughts on making a statics page using your data? For example, estimated owned accounts, estimated active accounts, etc. I know it's limited, but seeing as you have the data, would be interesting.

@bricefrisco
Copy link
Owner

bricefrisco commented Sep 14, 2023

Oh I wasn't aware their API was available so readily, I should have done a Google Search before requesting you to make your API public. I'll go ahead and do this. Thank you.

EDIT: Oh, completely missed the development key is temporary for 24 hours and you still need to apply which I wasn't trying to deal with. Although I suppose I have no option but to wait to apply after Jan 3rd (they suspended apps).

Also, personally I was more interested in using your endpoint for specific names, but having your name list would not be a bad idea.

Side note, what are your thoughts on making a statics page using your data? For example, estimated owned accounts, estimated active accounts, etc. I know it's limited, but seeing as you have the data, would be interesting.

A bit of a late response here, but I will be working on making a public API in the next month or so. The public API will have rate limits similar to that of Riots, so it will be pointless to use it for the sole purpose of bypassing Riot's rate limits. But, it may be useful in other legitimate use-cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants