diff --git a/lib/doodstream-upload.js b/lib/doodstream-upload.js index 010ad9d..a111ac1 100644 --- a/lib/doodstream-upload.js +++ b/lib/doodstream-upload.js @@ -286,16 +286,59 @@ class DoodstreamUploader { } if (!payload) { - // Try to extract from HTML response - const match = resText.match(/filecode['":\s]+['"]([a-zA-Z0-9]+)['"]/i); - if (match) { + // Try to extract filecode directly from HTML + const codeMatch = resText.match(/filecode['":\s]+['"]([a-zA-Z0-9]+)['"]/i); + if (codeMatch) { return { - download_url: `https://doodstream.com/d/${match[1]}`, - embed_url: `https://doodstream.com/e/${match[1]}`, - file_code: match[1] + download_url: `https://doodstream.com/d/${codeMatch[1]}`, + embed_url: `https://doodstream.com/e/${codeMatch[1]}`, + file_code: codeMatch[1] }; } - throw new Error(`Doodstream Upload: Keine gueltige Antwort (HTTP ${statusCode}, Body: ${resText.slice(0, 150)})`); + + // Follow HTML form redirect (two-step upload) + const formAction = resText.match(/