Update app.js
Browse files
app.js
CHANGED
|
@@ -24,15 +24,13 @@ import { CookieJar } from 'tough-cookie';
|
|
| 24 |
import * as cheerio from 'cheerio';
|
| 25 |
import TurndownService from 'turndown';
|
| 26 |
import { Readable } from 'stream';
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
};
|
| 34 |
-
const cf = new TurnstileBypass(bypassOptions);
|
| 35 |
-
|
| 36 |
dotenv.config();
|
| 37 |
|
| 38 |
const config = {
|
|
@@ -2419,17 +2417,18 @@ app.get('/colorifyai', async (req, res) => {
|
|
| 2419 |
}
|
| 2420 |
});
|
| 2421 |
|
| 2422 |
-
app.get('/
|
| 2423 |
-
const { url } = req.query;
|
| 2424 |
|
| 2425 |
if (!url) {
|
| 2426 |
return res.status(400).json({ error: 'Parameter URL diperlukan.' });
|
| 2427 |
}
|
| 2428 |
|
| 2429 |
try {
|
| 2430 |
-
const bypassResult = await
|
|
|
|
| 2431 |
|
| 2432 |
-
if (bypassResult
|
| 2433 |
res.json({
|
| 2434 |
message: 'Turnstile berhasil di-bypass!',
|
| 2435 |
data: bypassResult
|
|
|
|
| 24 |
import * as cheerio from 'cheerio';
|
| 25 |
import TurndownService from 'turndown';
|
| 26 |
import { Readable } from 'stream';
|
| 27 |
+
const scraper = new Scraper({
|
| 28 |
+
headless: false,
|
| 29 |
+
skip_chromium_download: false,
|
| 30 |
+
chromium_path: "/usr/bin/chromium-browser",
|
| 31 |
+
wait_for_network_idle: false,
|
| 32 |
+
PUP_TIMEOUT: 16_000,
|
| 33 |
+
});
|
|
|
|
|
|
|
| 34 |
dotenv.config();
|
| 35 |
|
| 36 |
const config = {
|
|
|
|
| 2417 |
}
|
| 2418 |
});
|
| 2419 |
|
| 2420 |
+
app.get('/cf-bypass', async (req, res) => {
|
| 2421 |
+
const { url, ...rest } = req.query;
|
| 2422 |
|
| 2423 |
if (!url) {
|
| 2424 |
return res.status(400).json({ error: 'Parameter URL diperlukan.' });
|
| 2425 |
}
|
| 2426 |
|
| 2427 |
try {
|
| 2428 |
+
const bypassResult = await scraper
|
| 2429 |
+
.proxy(url, rest);
|
| 2430 |
|
| 2431 |
+
if (bypassResult) {
|
| 2432 |
res.json({
|
| 2433 |
message: 'Turnstile berhasil di-bypass!',
|
| 2434 |
data: bypassResult
|