2:I[5294,["231","static/chunks/231-987d5c3e911703df.js","458","static/chunks/458-4089d99a84ebbe2b.js","235","static/chunks/235-5238db898b5afbf7.js","80","static/chunks/app/headless/page-5ce63b682f63fab6.js"],"Code"]
3:I[5294,["231","static/chunks/231-987d5c3e911703df.js","458","static/chunks/458-4089d99a84ebbe2b.js","235","static/chunks/235-5238db898b5afbf7.js","80","static/chunks/app/headless/page-5ce63b682f63fab6.js"],"Pre"]
4:I[5294,["231","static/chunks/231-987d5c3e911703df.js","458","static/chunks/458-4089d99a84ebbe2b.js","235","static/chunks/235-5238db898b5afbf7.js","80","static/chunks/app/headless/page-5ce63b682f63fab6.js"],"CodeGroup"]
6:I[2734,["231","static/chunks/231-987d5c3e911703df.js","458","static/chunks/458-4089d99a84ebbe2b.js","235","static/chunks/235-5238db898b5afbf7.js","80","static/chunks/app/headless/page-5ce63b682f63fab6.js"],"Heading"]
8:I[231,["231","static/chunks/231-987d5c3e911703df.js","458","static/chunks/458-4089d99a84ebbe2b.js","235","static/chunks/235-5238db898b5afbf7.js","80","static/chunks/app/headless/page-5ce63b682f63fab6.js"],""]
9:I[2403,["231","static/chunks/231-987d5c3e911703df.js","458","static/chunks/458-4089d99a84ebbe2b.js","235","static/chunks/235-5238db898b5afbf7.js","80","static/chunks/app/headless/page-5ce63b682f63fab6.js"],"Feedback"]
a:I[9275,[],""]
b:I[1343,[],""]
5:T1c09,import { GologinApi } from 'gologin';
const token = process.env.GL_API_TOKEN;
const gologin = GologinApi({ token });
async function main() {
const { browser } = await gologin.launch({headless: true});
const page = await browser.newPage();
await page.goto('https://iphey.com/', { waitUntil: 'networkidle2' });
const status = await page.$eval('.trustworthy-status:not(.hide)',
(elt) => elt?.innerText?.trim()
);
return status; // Expecting 'Trustworthy'
}
main().catch(console.error).
then(console.info).finally(gologin.exit);
7:T4a5,git clone git@github.com:gologinapp/gologin.git
cd gologin
npm install
GL_API_TOKEN=[YOUR_GOLOGIN_API_TOKEN] node examples/example-headless.js
0:["6ZCz-VlG0khrc3itF4UQu",[[["",{"children":["headless",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["headless",{"children":["__PAGE__",{},[["$L1",["$","article",null,{"className":"flex h-full flex-col pb-10 pt-16","children":[["$","div",null,{"className":"flex-auto prose dark:prose-invert [html_:where(&>*)]:mx-auto [html_:where(&>*)]:max-w-2xl [html_:where(&>*)]:lg:mx-[calc(50%-min(50%,theme(maxWidth.lg)))] [html_:where(&>*)]:lg:max-w-3xl","children":[["$","h1",null,{"children":"Using headless browser mode for scrapping"}],"\n",["$","p",null,{"children":["To make scrapping browser start in headless mode just add ",["$","$L2",null,{"children":"headless: true"}]," to the list of params when calling the ",["$","$L2",null,{"children":"launch()"}]," function."]}],"\n",["$","$L3",null,{"code":" const { browser } = await gologin.launch({headless: true});\n","children":["$","$L2",null,{"children":" const { browser } = await gologin.launch({headless: true});\n"}]}],"\n",["$","h1",null,{"children":"Benefits of running scraping browser in the Cloud"}],"\n",["$","ul",null,{"children":["\n",["$","li",null,{"children":[["$","strong",null,{"children":"Cost Savings"}],": Lower resource usage translates to lower operational costs, especially in cloud environments where resources are billed based on usage."]}],"\n",["$","li",null,{"children":[["$","strong",null,{"children":"Scalability"}],": Reduced resource consumption and increased speed mean that you can run more scraping instances simultaneously, enhancing scalability."]}],"\n",["$","li",null,{"children":[["$","strong",null,{"children":"Resource Efficiency"}],": Headless browsers consume less memory and CPU since they don't have to render a user interface, leading to more efficient use of system resources."]}],"\n",["$","li",null,{"children":[["$","strong",null,{"children":"Automation"}],": Headless mode is well-suited for automated scripts, allowing for seamless integration with CI/CD pipelines and other automated processes."]}],"\n",["$","li",null,{"children":[["$","strong",null,{"children":"Less Bandwidth"}],": Since headless browsers don't load unnecessary UI elements, they typically use less bandwidth, which can be beneficial for large-scale scraping operations."]}],"\n",["$","li",null,{"children":[["$","strong",null,{"children":"Remote Execution"}],": Headless browsers can be run on remote servers without needing a display, making it easier to manage and deploy scraping tasks across different environments."]}],"\n",["$","li",null,{"children":[["$","strong",null,{"children":"Parallel Execution"}],": The lightweight nature of headless browsers allows for running multiple instances in parallel, improving the efficiency of scraping operations."]}],"\n",["$","li",null,{"children":[["$","strong",null,{"children":"Continuous Monitoring"}],": They are ideal for continuous monitoring of websites for changes, such as price tracking, content updates, or availability checks."]}],"\n",["$","li",null,{"children":[["$","strong",null,{"children":"Security"}],": Running headless browsers can mitigate the risk of drive-by downloads and other security threats associated with rendering untrusted web pages."]}],"\n",["$","li",null,{"children":[["$","strong",null,{"children":"Non-interactive Operations"}],": Perfect for scenarios where no user interaction is required, such as backend data collection and processing."]}],"\n",["$","li",null,{"children":[["$","strong",null,{"children":"API Simulation"}],": Headless browsers can simulate user interactions with APIs in web applications, allowing for comprehensive end-to-end testing."]}],"\n",["$","li",null,{"children":[["$","strong",null,{"children":"Speed"}],": Without the overhead of rendering a UI, headless browsers can load and interact with web pages faster than their full-featured counterparts."]}],"\n"]}],"\n",["$","h3",null,{"children":"Code sample using Headless browser scrapping"}],"\n",["$","$L4",null,{"tag":"headless","label":"Run headless browser","children":[["$","$L3",null,{"language":"js","code":"import { GologinApi } from 'gologin';\n\nconst token = process.env.GL_API_TOKEN;\nconst gologin = GologinApi({ token });\n\nasync function main() {\n const { browser } = await gologin.launch({headless: true});\n const page = await browser.newPage();\n await page.goto('https://iphey.com/', { waitUntil: 'networkidle2' });\n const status = await page.$eval('.trustworthy-status:not(.hide)', \n (elt) => elt?.innerText?.trim()\n );\n\n return status; // Expecting 'Trustworthy'\n}\n\nmain().catch(console.error).\n then(console.info).finally(gologin.exit);\n","children":["$","$L2",null,{"className":"language-js","children":"$5"}]}],["$","$L3",null,{"language":"python","code":"PYTHON\n\n","children":["$","$L2",null,{"className":"language-python","children":"PYTHON\n\n"}]}]]}],"\n",["$","$L6",null,{"level":2,"id":"clone-and-run-headless-scraping-browser-code-sample","children":"Clone and run headless scraping browser code sample"}],"\n",["$","p",null,{"children":"Start with pre-build and tested code example:"}],"\n",["$","$L4",null,{"tag":"github.com","label":"Run scrapping example","children":["$","$L3",null,{"language":"bash","code":"git clone git@github.com:gologinapp/gologin.git\ncd gologin\nnpm install\n\nGL_API_TOKEN=[YOUR_GOLOGIN_API_TOKEN] node examples/example-headless.js\n","children":["$","$L2",null,{"className":"language-bash","children":"$7"}]}]}],"\n",["$","$L6",null,{"level":2,"id":"whats-next","children":"What's next?"}],"\n",["$","p",null,{"children":"Great, you're now set up with an API client and have made your first request to the API. Here are a few links that might be handy as you venture further into the GoLogin API:"}],"\n",["$","ul",null,{"children":["\n",["$","li",null,{"children":["$","$L8",null,{"href":"https://app.gologin.com/personalArea/TokenApi","children":"Grab your API key from the Settings > API"}]}],"\n"]}]]}],["$","footer",null,{"className":"mx-auto mt-16 w-full max-w-2xl lg:max-w-5xl","children":["$","$L9",null,{}]}]]}]],null],null]},["$","$La",null,{"parallelRouterKey":"children","segmentPath":["children","headless","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$Lb",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","styles":null}],null]},["$Lc",null],null],[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/027cc402be06af88.css","precedence":"next","crossOrigin":"$undefined"}]],"$Ld"]]]]
d:[["$","meta","0",{"name":"viewport","content":"width=device-width, initial-scale=1"}],["$","meta","1",{"charSet":"utf-8"}],["$","title","2",{"children":"Using headless mode browser for scrapping - GoLogin API Reference"}],["$","meta","3",{"name":"description","content":"This guide will get you all set up and ready to use the GoLogin API. We’ll cover how to get started an API client and how to make your first API request."}],["$","link","4",{"rel":"icon","href":"/favicon.ico","type":"image/x-icon","sizes":"16x16"}]]
1:null
e:I[2650,["231","static/chunks/231-987d5c3e911703df.js","458","static/chunks/458-4089d99a84ebbe2b.js","533","static/chunks/533-463131cc62f06a62.js","173","static/chunks/173-fc203c72e72da31b.js","192","static/chunks/192-bdca0343973e6cb5.js","235","static/chunks/235-5238db898b5afbf7.js","185","static/chunks/app/layout-1476186cd824e018.js"],"Providers"]
f:I[7010,["231","static/chunks/231-987d5c3e911703df.js","458","static/chunks/458-4089d99a84ebbe2b.js","533","static/chunks/533-463131cc62f06a62.js","173","static/chunks/173-fc203c72e72da31b.js","192","static/chunks/192-bdca0343973e6cb5.js","235","static/chunks/235-5238db898b5afbf7.js","185","static/chunks/app/layout-1476186cd824e018.js"],"Layout"]
10:I[4080,["231","static/chunks/231-987d5c3e911703df.js","458","static/chunks/458-4089d99a84ebbe2b.js","533","static/chunks/533-463131cc62f06a62.js","173","static/chunks/173-fc203c72e72da31b.js","192","static/chunks/192-bdca0343973e6cb5.js","235","static/chunks/235-5238db898b5afbf7.js","185","static/chunks/app/layout-1476186cd824e018.js"],""]
11:T47c,
const APP_ID = 'izr1nygf';
const user = {
// user_id: 1,
// email: 'dima.kaigorod@gmail.com',
// name: ''
};
window.intercomSettings = {
api_base: "https://api-iam.intercom.io",
app_id: APP_ID,
user_id: user.user_id, // IMPORTANT: Replace "user.id" with the variable you use to capture the user's ID
name: user.name, // IMPORTANT: Replace "user.name" with the variable you use to capture the user's name
email: user.email, // IMPORTANT: Replace "user.email" with the variable you use to capture the user's email address
};
(function(){var w=window;var ic=w.Intercom;if(typeof ic==="function"){ic('update',w.intercomSettings);}else{var d=document;var i=function(){i.c(arguments);};i.q=[];i.c=function(args){i.q.push(args);};w.Intercom=i;var l=function(){var s=d.createElement('script');s.type='text/javascript';s.async=true;s.src='https://widget.intercom.io/widget/' + APP_ID;var x=d.getElementsByTagName('script')[0];x.parentNode.insertBefore(s, x);};if(document.readyState==='complete'){l();}else if(w.attachEvent){w.attachEvent('onload',l);}else{w.addEventListener('load',l,false);}}})();
c:["$","html",null,{"lang":"en","className":"h-full","suppressHydrationWarning":true,"children":["$","body",null,{"className":"flex min-h-full bg-white antialiased dark:bg-zinc-900","children":[["$","$Le",null,{"children":["$","div",null,{"className":"w-full","children":["$","$Lf",null,{"allSections":{"/":[{"title":"Guides","id":"guides"},{"title":"Resources","id":"resources"}],"/attachments":[{"title":"The attachment model","id":"the-attachment-model"},{"title":"List all attachments","id":"list-all-attachments","tag":"GET","label":"/v1/attachments"},{"title":"Create an attachment","id":"create-an-attachment","tag":"POST","label":"/v1/attachments"},{"title":"Retrieve an attachment","id":"retrieve-an-attachment","tag":"GET","label":"/v1/attachments/:id"},{"title":"Update an attachment","id":"update-an-attachment","tag":"PUT","label":"/v1/attachments/:id"},{"title":"Delete an attachment","id":"delete-an-attachment","tag":"DELETE","label":"/v1/attachments/:id"}],"/cloud":[{"title":"Make your first run of browser in the cloud","id":"make-your-first-run-of-browser-in-the-cloud"},{"title":"Running code yourself","id":"running-code-yourself"},{"title":"What's next?","id":"whats-next"}],"/contacts":[{"title":"The contact model","id":"the-contact-model"},{"title":"List all contacts","id":"list-all-contacts","tag":"GET","label":"/v1/contacts"},{"title":"Create a contact","id":"create-a-contact","tag":"POST","label":"/v1/contacts"},{"title":"Retrieve a contact","id":"retrieve-a-contact","tag":"GET","label":"/v1/contacts/:id"},{"title":"Update a contact","id":"update-a-contact","tag":"PUT","label":"/v1/contacts/:id"},{"title":"Delete a contact","id":"delete-a-contact","tag":"DELETE","label":"/v1/contacts/:id"}],"/authentication":[{"title":"OAuth2 with bearer token","id":"o-auth2-with-bearer-token"},{"title":"Using an GologinApi instance","id":"using-an-gologin-api-instance"},{"title":"Using an SDK","id":"using-an-sdk"}],"/conversations":[{"title":"The conversation model","id":"the-conversation-model"},{"title":"List all conversations","id":"list-all-conversations","tag":"GET","label":"/v1/conversations"},{"title":"Create a conversation","id":"create-a-conversation","tag":"POST","label":"/v1/conversations"},{"title":"Retrieve a conversation","id":"retrieve-a-conversation","tag":"GET","label":"/v1/conversations/:id"},{"title":"Update a conversation","id":"update-a-conversation","tag":"PUT","label":"/v1/conversations/:id"},{"title":"Delete a conversation","id":"delete-a-conversation","tag":"DELETE","label":"/v1/conversations/:id"}],"/custom-proxies":[{"title":"Clone and run headless scraping browser code sample","id":"clone-and-run-headless-scraping-browser-code-sample"},{"title":"What's next?","id":"whats-next"}],"/errors":[{"title":"Status codes","id":"status-codes"},{"title":"Error types","id":"error-types"}],"/profiles":[{"title":"List all groups","id":"list-all-groups","tag":"GET","label":"/v1/groups"},{"title":"Create a group","id":"create-a-group","tag":"POST","label":"/v1/groups"},{"title":"Retrieve a group","id":"retrieve-a-group","tag":"GET","label":"/v1/groups/:id"},{"title":"Update a group","id":"update-a-group","tag":"PUT","label":"/v1/groups/:id"},{"title":"Delete a group","id":"delete-a-group","tag":"DELETE","label":"/v1/groups/:id"}],"/provided-proxies":[{"title":"Clone and run headless scraping browser code sample","id":"clone-and-run-headless-scraping-browser-code-sample"},{"title":"What's next?","id":"whats-next"}],"/quickstart":[{"title":"Making your first anonymous scrapping request","id":"making-your-first-anonymous-scrapping-request"},{"title":"What this script does, step by step","id":"what-this-script-does-step-by-step"},{"title":"Running code yourself","id":"running-code-yourself"},{"title":"What's next?","id":"whats-next"}],"/recaptcha":[{"title":"Making your first anonymous scrapping request","id":"making-your-first-anonymous-scrapping-request"},{"title":"What this script does, step by step","id":"what-this-script-does-step-by-step"},{"title":"Running code yourself","id":"running-code-yourself"},{"title":"What's next?","id":"whats-next"}],"/sdks":[{"title":"Official libraries","id":"official-libraries"}],"/headless":[{"title":"Clone and run headless scraping browser code sample","id":"clone-and-run-headless-scraping-browser-code-sample"},{"title":"What's next?","id":"whats-next"}]},"children":["$","$La",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$Lb",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[["$","div",null,{"className":"absolute inset-0 -z-10 mx-0 max-w-none overflow-hidden","children":["$","div",null,{"className":"absolute left-1/2 top-0 ml-[-38rem] h-[25rem] w-[81.25rem] dark:[mask-image:linear-gradient(white,transparent)]","children":[["$","div",null,{"className":"absolute inset-0 bg-gradient-to-r from-[#36b49f] to-[#DBFF75] opacity-40 [mask-image:radial-gradient(farthest-side_at_top,white,transparent)] dark:from-[#36b49f]/30 dark:to-[#DBFF75]/30 dark:opacity-100","children":["$","svg",null,{"aria-hidden":"true","className":"absolute inset-x-0 inset-y-[-50%] h-[200%] w-full skew-y-[-18deg] fill-black/40 stroke-black/50 mix-blend-overlay dark:fill-white/2.5 dark:stroke-white/5","children":[["$","defs",null,{"children":["$","pattern",null,{"id":":S1:","width":72,"height":56,"patternUnits":"userSpaceOnUse","x":-12,"y":4,"children":["$","path",null,{"d":"M.5 56V.5H72","fill":"none"}]}]}],["$","rect",null,{"width":"100%","height":"100%","strokeWidth":0,"fill":"url(#:S1:)"}],["$","svg",null,{"x":-12,"y":4,"className":"overflow-visible","children":[["$","rect","4-3",{"strokeWidth":"0","width":73,"height":57,"x":288,"y":168}],["$","rect","2-1",{"strokeWidth":"0","width":73,"height":57,"x":144,"y":56}],["$","rect","7-3",{"strokeWidth":"0","width":73,"height":57,"x":504,"y":168}],["$","rect","10-6",{"strokeWidth":"0","width":73,"height":57,"x":720,"y":336}]]}]]}]}],["$","svg",null,{"viewBox":"0 0 1113 440","aria-hidden":"true","className":"absolute left-1/2 top-0 ml-[-19rem] w-[69.5625rem] fill-white blur-[26px] dark:hidden","children":["$","path",null,{"d":"M.016 439.5s-9.5-300 434-300S882.516 20 882.516 20V0h230.004v439.5H.016Z"}]}]]}]}],["$","div",null,{"className":"mx-auto flex h-full max-w-xl flex-col items-center justify-center py-16 text-center","children":[["$","p",null,{"className":"text-sm font-semibold text-zinc-900 dark:text-white","children":"404"}],["$","h1",null,{"className":"mt-2 text-2xl font-bold text-zinc-900 dark:text-white","children":"Page not found"}],["$","p",null,{"className":"mt-2 text-base text-zinc-600 dark:text-zinc-400","children":"Sorry, we couldn’t find the page you’re looking for."}],["$","$L8",null,{"className":"inline-flex gap-0.5 justify-center overflow-hidden text-sm font-medium transition rounded-full bg-zinc-900 py-1 px-3 text-white hover:bg-zinc-700 dark:bg-emerald-400/10 dark:text-emerald-400 dark:ring-1 dark:ring-inset dark:ring-emerald-400/20 dark:hover:bg-emerald-400/10 dark:hover:text-emerald-300 dark:hover:ring-emerald-300 mt-8","href":"/","children":[false,"Back to docs",["$","svg",null,{"viewBox":"0 0 20 20","fill":"none","aria-hidden":"true","className":"mt-0.5 h-5 w-5 -mr-1","children":["$","path",null,{"stroke":"currentColor","strokeLinecap":"round","strokeLinejoin":"round","d":"m11.5 6.5 3 3.5m0 0-3 3.5m3-3.5h-9"}]}]]}]]}]],"notFoundStyles":[],"styles":null}]}]}]}],["$","$L10",null,{"id":"intercom","dangerouslySetInnerHTML":{"__html":"$11"}}]]}]}]