[{"data":1,"prerenderedAt":529},["ShallowReactive",2],{"navigation_docs":3,"-guide-scrape":88,"-guide-scrape-surround":524},[4,48],{"title":5,"path":6,"stem":7,"children":8,"icon":47},"Guide","\u002Fguide","1.guide\u002F01.index",[9,11,15,19,23,27,31,35,39,43],{"title":10,"path":6,"stem":7},"Getting Started",{"title":12,"path":13,"stem":14},"Scrape","\u002Fguide\u002Fscrape","1.guide\u002F02.scrape",{"title":16,"path":17,"stem":18},"Screenshots and PDFs","\u002Fguide\u002Fcaptures","1.guide\u002F03.captures",{"title":20,"path":21,"stem":22},"Links and accessibility and extract","\u002Fguide\u002Freading","1.guide\u002F04.reading",{"title":24,"path":25,"stem":26},"Crawl and search","\u002Fguide\u002Fcrawl","1.guide\u002F05.crawl",{"title":28,"path":29,"stem":30},"Sessions","\u002Fguide\u002Fsessions","1.guide\u002F06.sessions",{"title":32,"path":33,"stem":34},"CLI","\u002Fguide\u002Fcli","1.guide\u002F07.cli",{"title":36,"path":37,"stem":38},"MCP and Pi and OMP","\u002Fguide\u002Fagents","1.guide\u002F08.agents",{"title":40,"path":41,"stem":42},"Errors","\u002Fguide\u002Ferrors","1.guide\u002F09.errors",{"title":44,"path":45,"stem":46},"Custom providers","\u002Fguide\u002Fcustom","1.guide\u002F10.custom","i-lucide-book-open",{"title":49,"path":50,"stem":51,"children":52,"icon":87},"Providers","\u002Fproviders","2.providers\u002F00.index",[53,55,59,63,67,71,75,79,83],{"title":54,"path":50,"stem":51},"Every provider",{"title":56,"path":57,"stem":58},"Steel","\u002Fproviders\u002Fsteel","2.providers\u002F01.steel",{"title":60,"path":61,"stem":62},"Browserbase","\u002Fproviders\u002Fbrowserbase","2.providers\u002F02.browserbase",{"title":64,"path":65,"stem":66},"Kernel","\u002Fproviders\u002Fkernel","2.providers\u002F03.kernel",{"title":68,"path":69,"stem":70},"Browserless","\u002Fproviders\u002Fbrowserless","2.providers\u002F04.browserless",{"title":72,"path":73,"stem":74},"Hyperbrowser","\u002Fproviders\u002Fhyperbrowser","2.providers\u002F05.hyperbrowser",{"title":76,"path":77,"stem":78},"Anchor","\u002Fproviders\u002Fanchor","2.providers\u002F06.anchor",{"title":80,"path":81,"stem":82},"Cloudflare","\u002Fproviders\u002Fcloudflare","2.providers\u002F07.cloudflare",{"title":84,"path":85,"stem":86},"Playwright","\u002Fproviders\u002Fplaywright","2.providers\u002F08.playwright","i-lucide-server",{"id":89,"title":12,"body":90,"description":517,"extension":518,"links":519,"meta":520,"navigation":191,"path":13,"seo":522,"stem":14,"__hash__":523},"docs\u002F1.guide\u002F02.scrape.md",{"type":91,"value":92,"toc":510},"minimark",[93,98,111,114,121,150,154,305,343,347,357,460,466,470,478,485,488,492,506],[94,95,97],"h2",{"id":96},"one-call-a-different-answer-from-each","One call, a different answer from each",[99,100,101,102,106,107,110],"p",{},"Same URL, same tool, same afternoon. This is ",[103,104,105],"code",{},"browsers_scrape"," on ",[103,108,109],{},"https:\u002F\u002Fexample.com"," through every provider, recorded with real keys and kept exactly as it came back.",[112,113],"scrape-walk",{},[99,115,116,117,120],{},"Look at the sizes. Steel, Kernel and Browserless hand back the raw HTML, stylesheet and all, for a page with a few sentences on it. Browserbase and Hyperbrowser answer in markdown. Playwright gives you ",[103,118,119],{},"innerText",". Cloudflare gives markdown with a front matter block on top. Anchor says no.",[99,122,123,124,127,128,131,132,135,136,135,139,135,142,145,146,149],{},"None of that is a bug in this package. It's what the vendors return, and hiding it behind a fake \"normalized\" text would be worse. What the package does promise is the shape: a ",[103,125,126],{},"ScrapeResult"," with ",[103,129,130],{},"url"," and whichever of ",[103,133,134],{},"html",", ",[103,137,138],{},"markdown",[103,140,141],{},"text",[103,143,144],{},"title"," and ",[103,147,148],{},"statusCode"," the vendor filled.",[94,151,153],{"id":152},"in-typescript","In TypeScript",[155,156,161],"pre",{"className":157,"code":158,"language":159,"meta":160,"style":160},"language-ts shiki shiki-themes browsers browsers browsers","import { create } from \"@agntn\u002Fbrowsers\";\n\nconst provider = await create(\"cloudflare\");\nconst page = await provider.scrape(\"https:\u002F\u002Fexample.com\", {\n  formats: [\"markdown\", \"html\"],\n  waitFor: \"main\",\n});\n\npage.markdown;\npage.html;\npage.statusCode;\n","ts","",[103,162,163,186,193,221,247,264,276,282,287,293,299],{"__ignoreMap":160},[164,165,168,172,176,179,183],"span",{"class":166,"line":167},"line",1,[164,169,171],{"class":170},"skH_V","import",[164,173,175],{"class":174},"s38Sx"," { create } ",[164,177,178],{"class":170},"from",[164,180,182],{"class":181},"shU9J"," \"@agntn\u002Fbrowsers\"",[164,184,185],{"class":174},";\n",[164,187,189],{"class":166,"line":188},2,[164,190,192],{"emptyLinePlaceholder":191},true,"\n",[164,194,196,199,202,205,208,212,215,218],{"class":166,"line":195},3,[164,197,198],{"class":170},"const",[164,200,201],{"class":174}," provider ",[164,203,204],{"class":170},"=",[164,206,207],{"class":170}," await",[164,209,211],{"class":210},"sK71F"," create",[164,213,214],{"class":174},"(",[164,216,217],{"class":181},"\"cloudflare\"",[164,219,220],{"class":174},");\n",[164,222,224,226,229,231,233,236,239,241,244],{"class":166,"line":223},4,[164,225,198],{"class":170},[164,227,228],{"class":174}," page ",[164,230,204],{"class":170},[164,232,207],{"class":170},[164,234,235],{"class":174}," provider.",[164,237,238],{"class":210},"scrape",[164,240,214],{"class":174},[164,242,243],{"class":181},"\"https:\u002F\u002Fexample.com\"",[164,245,246],{"class":174},", {\n",[164,248,250,253,256,258,261],{"class":166,"line":249},5,[164,251,252],{"class":174},"  formats: [",[164,254,255],{"class":181},"\"markdown\"",[164,257,135],{"class":174},[164,259,260],{"class":181},"\"html\"",[164,262,263],{"class":174},"],\n",[164,265,267,270,273],{"class":166,"line":266},6,[164,268,269],{"class":174},"  waitFor: ",[164,271,272],{"class":181},"\"main\"",[164,274,275],{"class":174},",\n",[164,277,279],{"class":166,"line":278},7,[164,280,281],{"class":174},"});\n",[164,283,285],{"class":166,"line":284},8,[164,286,192],{"emptyLinePlaceholder":191},[164,288,290],{"class":166,"line":289},9,[164,291,292],{"class":174},"page.markdown;\n",[164,294,296],{"class":166,"line":295},10,[164,297,298],{"class":174},"page.html;\n",[164,300,302],{"class":166,"line":301},11,[164,303,304],{"class":174},"page.statusCode;\n",[99,306,307,308,135,311,314,315,135,318,135,321,135,324,135,327,145,330,333,334,145,336,338,339,342],{},"The options are ",[103,309,310],{},"formats",[103,312,313],{},"waitFor"," (a CSS selector), ",[103,316,317],{},"waitForNetworkIdle",[103,319,320],{},"screenshot",[103,322,323],{},"maxChars",[103,325,326],{},"timeout",[103,328,329],{},"script",[103,331,332],{},"headers",". Not every vendor honours every one, so treat them as requests. Cloudflare is the generous one here. Ask it for ",[103,335,134],{},[103,337,138],{}," together, or add ",[103,340,341],{},"screenshot: true",", and all of it comes out of one render.",[94,344,346],{"id":345},"session-or-no-session","Session or no session",[99,348,349,352,353,356],{},[103,350,351],{},"capabilities().statelessScrape"," says whether a provider scrapes without a session. Kernel is the one that doesn't. ",[103,354,355],{},"provider.scrape(url)"," there wants a session as its third argument:",[155,358,360],{"className":157,"code":359,"language":159,"meta":160,"style":160},"const kernel = await create(\"kernel\");\nconst session = await kernel.createSession();\ntry {\n  const page = await kernel.scrape(\"https:\u002F\u002Fexample.com\", {}, session);\n} finally {\n  await kernel.releaseSession(session.id);\n}\n",[103,361,362,382,402,410,432,442,455],{"__ignoreMap":160},[164,363,364,366,369,371,373,375,377,380],{"class":166,"line":167},[164,365,198],{"class":170},[164,367,368],{"class":174}," kernel ",[164,370,204],{"class":170},[164,372,207],{"class":170},[164,374,211],{"class":210},[164,376,214],{"class":174},[164,378,379],{"class":181},"\"kernel\"",[164,381,220],{"class":174},[164,383,384,386,389,391,393,396,399],{"class":166,"line":188},[164,385,198],{"class":170},[164,387,388],{"class":174}," session ",[164,390,204],{"class":170},[164,392,207],{"class":170},[164,394,395],{"class":174}," kernel.",[164,397,398],{"class":210},"createSession",[164,400,401],{"class":174},"();\n",[164,403,404,407],{"class":166,"line":195},[164,405,406],{"class":170},"try",[164,408,409],{"class":174}," {\n",[164,411,412,415,417,419,421,423,425,427,429],{"class":166,"line":223},[164,413,414],{"class":170},"  const",[164,416,228],{"class":174},[164,418,204],{"class":170},[164,420,207],{"class":170},[164,422,395],{"class":174},[164,424,238],{"class":210},[164,426,214],{"class":174},[164,428,243],{"class":181},[164,430,431],{"class":174},", {}, session);\n",[164,433,434,437,440],{"class":166,"line":249},[164,435,436],{"class":174},"} ",[164,438,439],{"class":170},"finally",[164,441,409],{"class":174},[164,443,444,447,449,452],{"class":166,"line":266},[164,445,446],{"class":170},"  await",[164,448,395],{"class":174},[164,450,451],{"class":210},"releaseSession",[164,453,454],{"class":174},"(session.id);\n",[164,456,457],{"class":166,"line":278},[164,458,459],{"class":174},"}\n",[99,461,462,463,465],{},"The CLI and the agent tools do exactly this for you, ",[103,464,439],{}," included. Forget the release in your own code and the vendor keeps billing the browser until its own timeout. Don't.",[94,467,469],{"id":468},"the-agents-version","The agent's version",[99,471,472,474,475,477],{},[103,473,105],{}," asks for markdown and hands the model text first, then markdown, then HTML, whichever exists. It stops at 20 000 characters unless you pass ",[103,476,323],{},", up to 200 000, and says how much it cut:",[155,479,483],{"className":480,"code":482,"language":141,"meta":160},[481],"language-text","[truncated 4200 of 24200 characters]\n",[103,484,482],{"__ignoreMap":160},[99,486,487],{},"So a model never gets a silent half page. It gets told.",[94,489,491],{"id":490},"kitesurf","Kitesurf",[99,493,494,495,135,498,501,502,505],{},"Cloudflare's Browser Run has a second engine, Kitesurf. Opt in with ",[103,496,497],{},"create(\"cloudflare\", { browser: \"kitesurf\" })",[103,499,500],{},"--browser kitesurf"," in the CLI, or ",[103,503,504],{},"browser: \"kitesurf\""," on a tool. Leave it out and Cloudflare stays on Chromium.",[507,508,509],"style",{},"html pre.shiki code .skH_V, html code.shiki .skH_V{--shiki-light:var(--shiki-token-keyword);--shiki-default:var(--shiki-token-keyword);--shiki-dark:var(--shiki-token-keyword)}html pre.shiki code .s38Sx, html code.shiki .s38Sx{--shiki-light:var(--ui-text-highlighted);--shiki-default:var(--ui-text-highlighted);--shiki-dark:var(--ui-text-highlighted)}html pre.shiki code .shU9J, html code.shiki .shU9J{--shiki-light:var(--shiki-token-string);--shiki-default:var(--shiki-token-string);--shiki-dark:var(--shiki-token-string)}html pre.shiki code .sK71F, html code.shiki .sK71F{--shiki-light:var(--shiki-token-function);--shiki-default:var(--shiki-token-function);--shiki-dark:var(--shiki-token-function)}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":160,"searchDepth":188,"depth":188,"links":511},[512,513,514,515,516],{"id":96,"depth":188,"text":97},{"id":152,"depth":188,"text":153},{"id":345,"depth":188,"text":346},{"id":468,"depth":188,"text":469},{"id":490,"depth":188,"text":491},"What scrape() hands back from each provider. HTML from some and markdown from others and an error from one","md",null,{"icon":521},"i-lucide-file-text",{"title":12,"description":517},"fT6S8qhVIPTSpvsznQX7TI6q2uJEw2eLNvIG9BGJLjA",[525,527],{"title":10,"path":6,"stem":7,"description":526,"children":-1},"Install the package and scrape one page with Playwright. No key and no account for the first call",{"title":16,"path":17,"stem":18,"description":528,"children":-1},"A picture of the page or of one element. A PDF straight to a file. Which providers do it without a session",1790685115878]