diff --git a/backend/clients/myTischtennisClient.js b/backend/clients/myTischtennisClient.js index 9bb8bb11..79738726 100644 --- a/backend/clients/myTischtennisClient.js +++ b/backend/clients/myTischtennisClient.js @@ -1,4 +1,5 @@ import axios from 'axios'; +import { chromium } from 'playwright'; const BASE_URL = 'https://www.mytischtennis.de'; @@ -24,36 +25,136 @@ class MyTischtennisClient { async getLoginPage() { try { const response = await this.client.get('/login?next=%2F'); - const html = response.data; + const html = typeof response.data === 'string' ? response.data : String(response.data || ''); + + const extractFirst = (patterns) => { + for (const pattern of patterns) { + const match = html.match(pattern); + if (match && (match[1] || match[2] || match[3])) { + return match[1] || match[2] || match[3]; + } + } + return null; + }; + + // Parse form action and input fields for frontend login-form endpoint + const formMatch = html.match(/