wudysoft commited on
Commit
e13cbae
·
verified ·
1 Parent(s): 65b4358

Update app.js

Browse files
Files changed (1) hide show
  1. app.js +12 -13
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
- import TurnstileBypass from 'turnstile-bypass';
28
- const bypassOptions = {
29
- puppeteer: {
30
- executablePath: '/root/.cache/puppeteer/chrome/linux-138.0.7204.92/chrome-linux64/chrome',
31
- args: ['--no-sandbox', '--disable-setuid-sandbox'] // Tambahkan ini penting untuk lingkungan server
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('/turnstile-bypass', async (req, res) => {
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 cf.solve(url);
 
2431
 
2432
- if (bypassResult && bypassResult.userAgent && bypassResult.cookies) {
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