mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-03-09 15:40:26 +00:00
feat: get all games on first request
This commit is contained in:
parent
ffaccba896
commit
6132ddd2b7
2 changed files with 37 additions and 15 deletions
|
|
@ -1,6 +1,10 @@
|
|||
import axios from "axios";
|
||||
import { JSDOM } from "jsdom";
|
||||
import shuffle from "lodash/shuffle";
|
||||
|
||||
export interface Steam250Game {
|
||||
title: string;
|
||||
objectID: string;
|
||||
}
|
||||
|
||||
export const requestSteam250 = async (path: string) => {
|
||||
return axios.get(`https://steam250.com${path}`).then((response) => {
|
||||
|
|
@ -28,7 +32,8 @@ const steam250Paths = [
|
|||
"/most_played",
|
||||
];
|
||||
|
||||
export const getRandomSteam250List = async () => {
|
||||
const [path] = shuffle(steam250Paths);
|
||||
return requestSteam250(path);
|
||||
export const getSteam250List = async () => {
|
||||
const gamesPromises = steam250Paths.map((path) => requestSteam250(path));
|
||||
const gamesList = (await Promise.all(gamesPromises)).flat();
|
||||
return [...new Set(gamesList)];
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue