<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Robert from ScreenshotRender</title>
    <description>The latest articles on DEV Community by Robert from ScreenshotRender (@robert_screenshotrender).</description>
    <link>https://dev.to/robert_screenshotrender</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4284816%2F9c7faf24-e8df-4434-b7aa-f2c4f551d3d1.png</url>
      <title>DEV Community: Robert from ScreenshotRender</title>
      <link>https://dev.to/robert_screenshotrender</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/robert_screenshotrender"/>
    <language>en</language>
    <item>
      <title>Turn Any Web Page into Clean Markdown for Your LLM with One API Call</title>
      <dc:creator>Robert from ScreenshotRender</dc:creator>
      <pubDate>Sat, 05 Dec 2026 13:37:17 +0000</pubDate>
      <link>https://dev.to/robert_screenshotrender/turn-any-web-page-into-clean-markdown-for-your-llm-with-one-api-call-563o</link>
      <guid>https://dev.to/robert_screenshotrender/turn-any-web-page-into-clean-markdown-for-your-llm-with-one-api-call-563o</guid>
      <description>&lt;p&gt;If you have ever stuffed a raw HTML response into a prompt, you already know the problem. The model spends tokens on scripts, class names, and layout wrappers, then still misses the paragraph that only appears after JavaScript runs. Large language models do better with Markdown: headings, lists, links, and tables, without the markup tax.&lt;/p&gt;

&lt;p&gt;This tutorial shows how to turn a live URL into that clean Markdown in one API call, in Node and in Python, then pass the text to a model. The examples use &lt;a href="https://docs.screenshotrender.com/features/scrape" rel="noopener noreferrer"&gt;ScreenshotRender's scrape endpoint&lt;/a&gt;, which loads the page in a real browser and returns Markdown by default. I'll also mention a few alternatives if you would rather stay local or use a different service.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Markdown, not raw HTML
&lt;/h2&gt;

&lt;p&gt;Three things go wrong when you hand a model a page as HTML.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Tokens.&lt;/strong&gt; A typical docs page can be 150 to 300 KB of HTML and only a few kilobytes of actual article text. You pay for every tag you send, and you leave less room in the context window for the question you actually care about.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Rendering.&lt;/strong&gt; A plain &lt;code&gt;fetch&lt;/code&gt; or &lt;code&gt;requests.get&lt;/code&gt; sees the first HTML document the server sends. On a React or Next.js app, that document is often a shell. The content your users see is painted later, in the browser.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Structure.&lt;/strong&gt; Markdown keeps the outline the model can use: &lt;code&gt;#&lt;/code&gt; headings for chunking in a RAG pipeline, lists, and links. That outline is much easier to split and embed than a tree of &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt;s.&lt;/p&gt;

&lt;p&gt;You can get some of the way there yourself: fetch the HTML, run Mozilla Readability or Trafilatura, then convert the result with Turndown or markdownify. That works well for static, server-rendered articles. It falls over on JavaScript-heavy pages, and you then have to run Playwright or Puppeteer yourself.&lt;/p&gt;

&lt;h2&gt;
  
  
  One call, one page of Markdown
&lt;/h2&gt;

&lt;p&gt;ScreenshotRender's scrape endpoint is a POST to &lt;code&gt;https://www.screenshotrender.com/api/v1/scrape&lt;/code&gt;. You send a URL and, optionally, the formats you want. &lt;code&gt;markdown&lt;/code&gt; is the default. Authenticate with a Bearer key (keys start with &lt;code&gt;sr-&lt;/code&gt;), or set &lt;code&gt;SCREENSHOTRENDER_API_KEY&lt;/code&gt;. New accounts start with 100 free credits and no credit card. A successful scrape costs 1 credit. Failed calls are not charged.&lt;/p&gt;

&lt;p&gt;Here is the same request with cURL, so you can see the shape before touching an SDK:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl -s -X POST &lt;span class="s2"&gt;"https://www.screenshotrender.com/api/v1/scrape"&lt;/span&gt; \
  -H &lt;span class="s2"&gt;"Authorization: Bearer $SCREENSHOTRENDER_API_KEY"&lt;/span&gt; \
  -H &lt;span class="s2"&gt;"Content-Type: application/json"&lt;/span&gt; \
  -d &lt;span class="s1"&gt;'{
    "url": "https://en.wikipedia.org/wiki/Web_scraping",
    "formats": ["markdown"]
  }'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A successful response looks like this (truncated):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;"success"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"data"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;"markdown"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"# Web scraping\n\nWeb scraping is the process of using a program to extract data from websites..."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"metadata"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nl"&gt;"title"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Web scraping - Wikipedia"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="nl"&gt;"description"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"..."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="nl"&gt;"sourceURL"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"https://en.wikipedia.org/wiki/Web_scraping"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="nl"&gt;"url"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"https://en.wikipedia.org/wiki/Web_scraping"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="nl"&gt;"statusCode"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="nl"&gt;"contentType"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"text/html; charset=UTF-8"&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"creditsUsed"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Check two layers of status. &lt;code&gt;success&lt;/code&gt; tells you the API call itself worked. &lt;code&gt;data.metadata.statusCode&lt;/code&gt; is the HTTP status of the page (a &lt;code&gt;200&lt;/code&gt; with &lt;code&gt;success: true&lt;/code&gt; can still wrap a &lt;code&gt;404&lt;/code&gt; page). The Markdown you want is &lt;code&gt;data.markdown&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Node.js
&lt;/h2&gt;

&lt;p&gt;Install the official SDK (Node 18 or later):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm install screenshotrender
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;ScreenshotRender&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s2"&gt;"screenshotrender"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;screenshotrender&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;ScreenshotRender&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;apiKey&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;SCREENSHOTRENDER_API_KEY&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;doc&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;screenshotrender&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;scrape&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="s2"&gt;"https://en.wikipedia.org/wiki/Web_scraping"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;formats&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"markdown"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;doc&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;metadata&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;statusCode&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sb"&gt;`Page returned ${doc.metadata.statusCode}`&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nb"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;doc&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;metadata&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;title&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nb"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;doc&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;markdown&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;slice&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;500&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The SDK returns the response's &lt;code&gt;data&lt;/code&gt; object, so you read &lt;code&gt;doc.markdown&lt;/code&gt; directly instead of &lt;code&gt;response.data.markdown&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Python
&lt;/h2&gt;

&lt;p&gt;The Python SDK needs 3.9 or later:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pip install screenshotrender
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;
&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;screenshotrender&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;ScreenshotRender&lt;/span&gt;

&lt;span class="n"&gt;screenshotrender&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;ScreenshotRender&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;api_key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;environ&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"SCREENSHOTRENDER_API_KEY"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;doc&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;screenshotrender&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;scrape&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="s2"&gt;"https://en.wikipedia.org/wiki/Web_scraping"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;formats&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"markdown"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;doc&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;metadata&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;status_code&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;raise&lt;/span&gt; &lt;span class="nc"&gt;RuntimeError&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"Page returned {doc.metadata.status_code}"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;doc&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;metadata&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;title&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;doc&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;markdown&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;500&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In Python, fields also accept snake_case: &lt;code&gt;doc.metadata.status_code&lt;/code&gt; is the same value as &lt;code&gt;doc["metadata"]["statusCode"]&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Options that matter once you leave the happy path
&lt;/h2&gt;

&lt;p&gt;The defaults are already aimed at LLM input. &lt;code&gt;onlyMainContent&lt;/code&gt; is &lt;code&gt;true&lt;/code&gt;, so headers, navs, and footers are dropped. Ads and cookie banners are blocked. Images embedded as base64 are removed. Cached copies up to two days old are accepted, which is fine for docs that rarely change. Set &lt;code&gt;maxAge&lt;/code&gt; to &lt;code&gt;0&lt;/code&gt; when you need a live load.&lt;/p&gt;

&lt;p&gt;A few options come up constantly in agent and RAG work:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Wait for late content.&lt;/strong&gt; &lt;code&gt;waitFor&lt;/code&gt; is extra milliseconds after the page loads. Use it when the main article appears a moment after hydration.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Click, then read.&lt;/strong&gt; &lt;code&gt;actions&lt;/code&gt; runs up to 50 steps in a real browser before the page is captured. A common pattern is clicking "Load more" and waiting:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;doc&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;screenshotrender&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;scrape&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"https://example.com/changelog"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;formats&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"markdown"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;waitFor&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;2000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;actions&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="kd"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"click"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;selector&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"button.load-more"&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="kd"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"wait"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;milliseconds&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Other documented actions include &lt;code&gt;write&lt;/code&gt;, &lt;code&gt;press&lt;/code&gt;, &lt;code&gt;scroll&lt;/code&gt;, &lt;code&gt;executeJavascript&lt;/code&gt;, and waiting on a CSS selector: &lt;code&gt;{ type: "wait", selector: "#results" }&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pages that block ordinary requests.&lt;/strong&gt; Set &lt;code&gt;proxy: "enhanced"&lt;/code&gt; to load the page through enhanced proxies. That costs 5 credits a page instead of 1. ScreenshotRender always respects &lt;code&gt;robots.txt&lt;/code&gt;. Requests that ask to ignore robots are refused.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Treat the page as untrusted.&lt;/strong&gt; A page can hide instructions aimed at your model. For any workflow that then calls an AI format, set &lt;code&gt;checkPromptInjection: true&lt;/code&gt; (4 extra credits) to scan the page first. Even with that flag, keep the Markdown in a clearly delimited user-data block in your prompt, and do not let a fetched page execute tools on its own.&lt;/p&gt;

&lt;p&gt;You can also ask for more than Markdown in the same call, for example &lt;code&gt;formats: ["markdown", "links"]&lt;/code&gt;, without a second request. Other formats on the same endpoint include cleaned &lt;code&gt;html&lt;/code&gt;, &lt;code&gt;summary&lt;/code&gt;, and a &lt;code&gt;json&lt;/code&gt; format when you want structured fields instead of prose. Those last AI formats cost extra credits.&lt;/p&gt;

&lt;h2&gt;
  
  
  Feed the Markdown to a model
&lt;/h2&gt;

&lt;p&gt;Once you have &lt;code&gt;doc.markdown&lt;/code&gt;, the model call is ordinary. Keep a hard cap so a long article cannot blow the context window, and label the page as untrusted content:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;markdown&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;doc&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;markdown&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;slice&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;24_000&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;prompt&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sb"&gt;`Answer the question using only the article below.
If the article does not contain the answer, say you cannot tell.

Question: ${question}

&amp;lt;article url="${doc.metadata.url}" title="${doc.metadata.title}"&amp;gt;
${markdown}
&amp;lt;/article&amp;gt;`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Pass &lt;code&gt;prompt&lt;/code&gt; to whatever model you already use. For a RAG pipeline, split on headings first, embed the chunks, and retrieve before you prompt. Because the text is already Markdown, heading-aware chunkers have a clean outline to work with.&lt;/p&gt;

&lt;h2&gt;
  
  
  PDFs and other documents
&lt;/h2&gt;

&lt;p&gt;Scrape is for web pages. If the URL points at a PDF, or you have a file on disk (PDF, DOCX, XLSX, PPTX, EPUB, and a few other office formats), use the parse endpoint instead. Credits are 1 per page it reads.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# A public PDF URL&lt;/span&gt;
&lt;span class="n"&gt;doc&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;screenshotrender&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;parse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="s2"&gt;"https://arxiv.org/pdf/1706.03762"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;parsers&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"pdf"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"max_pages"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;doc&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;markdown&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Other ways to get there
&lt;/h2&gt;

&lt;p&gt;You do not need a hosted API for every page.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Jina Reader&lt;/strong&gt; (&lt;code&gt;r.jina.ai&lt;/code&gt;) is a quick way to turn a public URL into Markdown, and it is enough for many static articles.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Firecrawl&lt;/strong&gt; offers a similar scrape-to-Markdown API if you already have an account there.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Trafilatura&lt;/strong&gt; (Python) and &lt;strong&gt;Mozilla Readability&lt;/strong&gt; are strong local extractors when you can fetch the HTML yourself.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Playwright&lt;/strong&gt; (or Puppeteer) plus Turndown is the self-hosted path for JavaScript-heavy sites, at the cost of running and scaling a browser.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A hosted renderer is worth it when you do not want to operate that browser fleet, or when a plain fetch keeps coming back with an empty shell or a block page.&lt;/p&gt;

&lt;p&gt;If you just want to try a single URL without writing code, ScreenshotRender also has a free &lt;a href="https://www.screenshotrender.com/tools/html-to-markdown" rel="noopener noreferrer"&gt;HTML to Markdown converter&lt;/a&gt; that accepts pasted HTML or a public page.&lt;/p&gt;

&lt;h2&gt;
  
  
  Wrap-up
&lt;/h2&gt;

&lt;p&gt;The working pattern is small: load the page in a browser, convert the main content to Markdown, check the page status, then send a capped, clearly delimited excerpt to your model. In Node or Python, that first step is one &lt;code&gt;scrape&lt;/code&gt; call. From there, the same Markdown can go into a chat prompt, a RAG index, or a daily research job, without dragging a full HTML document along with it.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>webdev</category>
      <category>tutorial</category>
      <category>python</category>
    </item>
  </channel>
</rss>
