diff --git a/lib/vidmoly-upload.js b/lib/vidmoly-upload.js index e4e8d07..f4e70d5 100644 --- a/lib/vidmoly-upload.js +++ b/lib/vidmoly-upload.js @@ -111,12 +111,22 @@ class VidmolyUploader { throw new Error('Vidmoly Login fehlgeschlagen: Falscher Username oder Passwort'); } - // Check for login cookie - const hasSession = this.cookies.has('login') || this.cookies.has('xfsts') || - this.cookies.size > 1; - if (!hasSession) { + // Verify session by fetching a logged-in-only page. Vidmoly redesigned + // the site and changed cookie names, so the old "has cookie 'login' or + // 'xfsts'" heuristic broke. Instead we hit /?op=my_account (or similar) + // and confirm we're not redirected to the login form. + if (this.cookies.size === 0) { throw new Error('Vidmoly Login fehlgeschlagen: Keine Session erhalten'); } + const verifyRes = await this._fetch(`${BASE_URL}/?op=my_account`); + const verifyBody = await verifyRes.text(); + // A logged-out page shows the login form (name="login" + name="password"); + // a logged-in page shows account info ("Logout", "My Account", "My Files"). + const looksLoggedIn = /(?:logout|my[_ ]?account|my[_ ]?files)/i.test(verifyBody) + && !/