Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Idea to bypass new protection. I give you the code below - turkish#1203

yusuff-a11 started this conversation inIdeas
Discussion options

constpuppeteer=require('puppeteer');constexpress=require('express');const {spawn }=require('child_process');const {promisify }=require("util");constsleep=promisify(setTimeout);letcookie="nocookie";constapp=express();constport=3000;letheaderslast="";constxvfbProcess=spawn('Xvfb', [':99','-screen','0','1280x1024x24']);asyncfunctioncheckElement(page,selector,timeout) {try {awaitpage.waitForSelector(selector, {timeout });returntrue;  }catch (error) {//Belirlibirzamanaşımınakadarelementbulunamadıconsole.log('Element bulunamadı veya zaman aşımına uğradı.');returnfalse;  }}asyncfunctioncheckElementWithXPath(page ,xpath,timeout) {try {awaitpage.waitForXPath(xpath, {timeout });returntrue;  }catch (error) {//Belirlibirzamanaşımınakadarelementbulunamadıconsole.log('Element bulunamadı veya zaman aşımına uğradı.');returnfalse;  }}asyncfunctionstep2(page,url,browser){variframe=awaitpage.waitForSelector("div[id='turnstile-wrapper']");constboundingBox=awaitiframe.boundingBox();constx=boundingBox.x+28;consty=boundingBox.y+30;awaitpage.reload();awaitbrowser.disconnect();awaitsleep(5000);awaitstep3(x,y,url);constbrowserURL="http://127.0.0.1:9223";browserInstance=awaitpuppeteer.connect({browserURL });return;}asyncfunctionstep3(x,y,url){awaitconsole.log("step2");constbrowserURL="http://127.0.0.1:9223";constbrowser2=awaitpuppeteer.connect({browserURL });constpages2=awaitbrowser2.pages();//Tümsayfalarıalın//Bekleyinvebirsayfayüklenenekadarwhile (pages2.length===0) {awaitsleep(2000);//1saniyebekleconsole.log("Sayfalar yükleniyor...");  }varpage2=pages2[0];for (constpageofpages2) {if (awaitpage.url().includes(url)) {console.log("bulundu",awaitpage.url());page2=page;break;    }  }page2.on('request', (request)=> {if (request.resourceType()==='document') {headerslast=request.headers()    }  });awaitpage2.mouse.click(x,y);awaitconsole.log("click",x,y,page2.url());awaitsleep(5000);cookie=awaitpage2.cookies();awaitsleep(500);awaitpage2.close();return;}asyncfunctionstep1(browser,url="https://google.com"){console.log("Running tests..");try {letpage=false;page=awaitbrowser.newPage();page.on('request', (request)=> {if (request.resourceType()==='document') {headerslast=request.headers()      }    });letresp=awaitpage.goto(url, {waitUntil:"networkidle0" });awaitsleep(2000);if(resp.status()==403){variframestat=awaitcheckElement(page,"div[id='turnstile-wrapper']",10000);if(iframestat){if(awaitcheckElement(page,"div[id='challenge-spinner']",5000)){console.log("spin");constisVisible=awaitpage.evaluate(()=> {constelement=document.querySelector('div[id="challenge-spinner"]');if (!element)returnfalse;//Eğerelementbulunamazsafalsedöndürconststyle=window.getComputedStyle(element);returnstyle&&style.display!=='none'&&style.visibility!=='hidden'&&style.opacity!=='0';        });if(isVisible){awaitpage.reload();awaitbrowser.disconnect();awaitsleep(20000);constnewbrowserURL="http://127.0.0.1:9223";browserInstance=awaitpuppeteer.connect({newbrowserURL });        }else{console.log("spinner bulunamadı1");awaitstep2(page,url,browser);        }      }else{console.log("spinner bulunamadı2");awaitstep2(page,url,browser);      }    }else{console.log("iframe bulunamadı");cookie=awaitpage.cookies();awaitsleep(500);awaitpage.close();    }    }else{console.log(200);cookie=awaitpage.cookies();awaitpage.close();    }console.log("Done!");returncookie;  }catch (error) {cookie="error";console.log("Hata:",error);return;  }}letbrowserInstance=null;asyncfunctionlaunchBrowser() {browserInstance=awaitpuppeteer.launch({args: ["--remote-debugging-port=9223","--no-sandbox"],defaultViewport:null,headless:false,ignoreHTTPSErrors:true,timeout:60000,env: {DISPLAY:':99'        }    });}asyncfunctionmain(url) {//Xvfb'yibaşlatconstxvfbProcess=spawn('Xvfb', [':99', '-screen', '0', '1280x1024x24']);if (!browserInstance) {awaitlaunchBrowser();}awaitstep1(browserInstance,url);}//Anasayfaiçinbirroutetanımlamaapp.get('/',async (req,res)=> {//checkurlparamif(req.query.url){url=req.query.url;awaitmain(url);//whileheaderslastawaitres.json({success:true,cookie:cookie,url:url,headers:headerslast});  }else{res.json({success:false,message:"url param not found"});  }});//localhost:3000üzerindensunucuyudinlemeapp.listen(port, ()=> {console.log(`Sunucu http://localhost:${port} adresinde çalışıyor!`);});
You must be logged in to vote

Replies: 1 comment

Comment options

I'm not really sure how you're suggesting this would be implemented. Can you open a PR?

You must be logged in to vote
0 replies
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Category
Ideas
Labels
None yet
2 participants
@yusuff-a11@ilike2burnthing

[8]ページ先頭

©2009-2025 Movatter.jp