import axios from 'axios'; import { firefox } from 'playwright-firefox'; import { authenticator } from 'otplib'; import path from 'node:path'; import { existsSync, readFileSync, writeFileSync } from 'node:fs'; import { resolve, jsonDb, datetime, stealth, filenamify, prompt, notify, html_game_list, handleSIGINT, } from './src/util.js'; import { cfg } from './src/config.js'; const URL_CLAIM = 'https://store.epicgames.com/en-US/free-games'; const COOKIES_PATH = path.resolve(cfg.dir.browser, 'epic-cookies.json'); const BEARER_TOKEN_NAME = 'EPIC_BEARER_TOKEN'; // Funktion für den Screenshot entfernt // const screenshot = (...a) => resolve(cfg.dir.screenshots, 'epic-games', ...a); // Fetch Free Games API const fetchFreeGamesAPI = async () => { const resp = await axios.get('https://store-site-backend-static-ipv4.ak.epicgames.com/freeGamesPromotions', { params: { locale: 'en-US', country: 'US', allowCountries: 'US,DE,AT,CH,GB' }, }); return resp.data?.Catalog?.searchStore?.elements ?.filter(g => g.promotions?.promotionalOffers?.[0]) ?.map(g => { const offer = g.promotions.promotionalOffers[0].promotionalOffers[0]; const mapping = g.catalogNs?.mappings?.[0]; return { title: g.title, namespace: mapping?.id || g.productSlug, pageSlug: mapping?.pageSlug || g.urlSlug, offerId: offer?.offerId, }; }) || []; }; // Weitere Funktionen ... const ensureLoggedIn = async (page, context) => { const isLoggedIn = async () => await page.locator('egs-navigation').getAttribute('isloggedin') === 'true'; const attemptAutoLogin = async () => { // ... Ihre Logik hier }; const isChallenge = async () => { const cfFrame = page.locator('iframe[title*="Cloudflare"], iframe[src*="challenges"]'); const cfText = page.locator('text=Verify you are human'); return await cfFrame.count() > 0 || await cfText.count() > 0; }; // Logik für den Login ... }; // Funktion für das Claimen des Spiels const claimGame = async (page, game) => { // ... }; export const claimEpicGamesNew = async () => { // ... }; export default claimEpicGamesNew;