Skip to content
This repository has been archived by the owner on Jan 4, 2025. It is now read-only.

Commit

Permalink
arrumado possivelmente coiso do cloudflare
Browse files Browse the repository at this point in the history
  • Loading branch information
uesleibros committed Sep 6, 2024
1 parent ed61f05 commit 36d5ea7
Show file tree
Hide file tree
Showing 3 changed files with 105 additions and 22 deletions.
91 changes: 91 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
},
"dependencies": {
"@nextui-org/react": "^2.4.6",
"axios": "^1.7.7",
"chart.js": "^2.9.3",
"disqus-react": "^1.1.5",
"framer-motion": "^11.3.28",
Expand Down
35 changes: 13 additions & 22 deletions src/app/api/imagens/anroll/route.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import axios from "axios":

export async function GET(request) {
const query = request.nextUrl.searchParams.get("q");

Expand All @@ -11,39 +13,28 @@ export async function GET(request) {
const url = decodeURIComponent(query);
const apikey = "ed59bacd6da711d678cf8baa6966aba6350d364a";

const res = await fetch(`https://api.zenrows.com/v1?apikey=${apikey}&original_status=true&custom_headers=true&url=${url}`, {
const res = await axios({
url: "https://api.zenrows.com/v1/",
method: "GET",
headers: {
"Referer": "https://www.anroll.net/",
"Sec-Ch-Ua": '"Chromium";v="128", "Not;A=Brand";v="24", "Google Chrome";v="128"',
"Sec-Ch-Ua-Arch": '"x86"',
"Sec-Ch-Ua-Bitness": '"64"',
"Sec-Ch-Ua-Full-Version": '"128.0.6613.117"',
"Sec-Ch-Ua-Full-Version-List": '"Chromium";v="128.0.6613.117", "Not;A=Brand";v="24.0.0.0", "Google Chrome";v="128.0.6613.117"',
"Sec-Ch-Ua-Mobile": "?0",
"Sec-Ch-Ua-Model": '',
"Sec-Ch-Ua-Platform": '"Windows"',
"Sec-Ch-Ua-Platform-Version": '"10.0.0"',
"Sec-Ch-Ua-Mobile": "?0",
"Sec-Ch-Ua-Platform": "\"Windows\"",
"Sec-Fetch-Dest": "document",
"Sec-Fetch-Mode": "navigate",
"Sec-Fetch-Site": "same-origin",
"Sec-Fetch-User": "?1",
"Service-Worker-Navigation-Preload": "true",
"Upgrade-Insecure-Requests": '1',
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36"
},
cache: "no-store",
params: {
"url": url,
"apikey": apikey,
"custom_headers": "true",
},
responseType: "arrayBuffer"
});

if (!res.ok) {
if (res.status !== 200) {
return new Response(
JSON.stringify({ error: "Failed to fetch the image." }),
{ status: res.status, headers: { "Content-Type": "application/json" } }
);
}

const imageBuffer = await res.arrayBuffer();
const imageBuffer = res.data;
const contentLength = imageBuffer.byteLength;

return new Response(imageBuffer, {
Expand Down

0 comments on commit 36d5ea7

Please sign in to comment.