diff --git a/README.md b/README.md index 86ee914..fb3314a 100644 --- a/README.md +++ b/README.md @@ -75,12 +75,14 @@ Bypass Cloudflare protection and get cookies/tokens. { "mode": "iuam", "domain": "https://olamovies.watch/generate", + "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36" } ``` #### Parameters - **`mode`** (required): `"iuam"` or `"turnstile"` - **`domain`** (required): Target website URL +- **`user_agent`** (optional): User-Agent to use for the browser session - **`proxy`** (optional): Proxy configuration object #### Response (Success) diff --git a/index.js b/index.js index 8d4fc21..176b798 100644 --- a/index.js +++ b/index.js @@ -97,6 +97,9 @@ app.post('/cloudflare', async (req, res) => { if (!data || typeof data.mode !== 'string') { return res.status(400).json({ message: 'Bad Request: missing or invalid mode' }) } + if (data.user_agent && typeof data.user_agent !== 'string') { + return res.status(400).json({ message: 'Bad Request: invalid user_agent' }) + } if (authToken && data.authToken !== authToken) { return res.status(401).json({ message: 'Unauthorized' }) } @@ -126,6 +129,9 @@ app.post('/cloudflare', async (req, res) => { page = ctx.page await page.goto('about:blank') + if (data.user_agent) { + await page.setUserAgent(data.user_agent) + } switch (data.mode) { case "turnstile": @@ -167,4 +173,4 @@ app.use((req, res) => { if (process.env.NODE_ENV === 'development') { module.exports = app -} \ No newline at end of file +}