<?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: Greenrun</title>
    <description>The latest articles on DEV Community by Greenrun (@greenrun).</description>
    <link>https://dev.to/greenrun</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%2F4256349%2F010c4967-92e3-4e67-b8e9-95445bc7eff4.png</url>
      <title>DEV Community: Greenrun</title>
      <link>https://dev.to/greenrun</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/greenrun"/>
    <language>en</language>
    <item>
      <title>Turn a list of file links into searchable text, and only process new files on every run</title>
      <dc:creator>Greenrun</dc:creator>
      <pubDate>Sun, 22 Nov 2026 12:31:26 +0000</pubDate>
      <link>https://dev.to/greenrun/turn-a-list-of-file-links-into-searchable-text-and-only-process-new-files-on-every-run-gg8</link>
      <guid>https://dev.to/greenrun/turn-a-list-of-file-links-into-searchable-text-and-only-process-new-files-on-every-run-gg8</guid>
      <description>&lt;p&gt;If a scraper, a supplier portal or a sitemap hands you links to PDFs and scanned images every week, you need two things: the text inside those files, and a way to skip the ones you have already processed. Remembering processed URLs is not enough: the same PDF shows up again with a tracking parameter, on a mirror or under a new name, and a file can change behind the same URL.&lt;/p&gt;

&lt;p&gt;This post chains four Apify Actors that we publish (disclosure: we are Greenrun, their authors) into one Python function: download every link and hash each file, keep only content that no earlier run has seen, then OCR the images and convert the documents to Markdown. All output below comes from two runs of the pipeline on 22 November 2026, one with this week's list of links and one with next week's.&lt;/p&gt;

&lt;h2&gt;
  
  
  How it works
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;a href="https://apify.com/greenrun/bulk-file-downloader" rel="noopener noreferrer"&gt;Bulk File Downloader&lt;/a&gt; downloads every link and writes one manifest row per link: final URL, type read from the bytes, size, SHA-256 and a signed link to the stored copy. Identical files within one run are stored once.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://apify.com/greenrun/dataset-merge-dedup" rel="noopener noreferrer"&gt;Merge &amp;amp; Deduplicate Datasets&lt;/a&gt; in only-new mode passes on only the rows whose SHA-256 no earlier run with the same memory name has written. The memory is a key-value store in your Apify account, so your script keeps no state.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://apify.com/greenrun/image-to-text-ocr" rel="noopener noreferrer"&gt;Image to Text OCR&lt;/a&gt; reads the new images: plain text, Markdown, and every line with its position and confidence.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://apify.com/greenrun/document-to-markdown" rel="noopener noreferrer"&gt;Document to Markdown&lt;/a&gt; converts the new PDFs and Office files to Markdown with page markers and tables.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Steps 3 and 4 read the copies stored in step 1, so every file is fetched from its source only once.&lt;/p&gt;

&lt;h2&gt;
  
  
  The code
&lt;/h2&gt;

&lt;p&gt;You need an Apify account and its API token. Each call waits for its run to finish and returns the run's items; &lt;code&gt;maxTotalChargeUsd&lt;/code&gt; caps what a run may cost.&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="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;

&lt;span class="no"&gt;API&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"https://api.apify.com/v2/acts"&lt;/span&gt;
&lt;span class="no"&gt;HEADERS&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"Authorization"&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;"Bearer {os.environ['APIFY_TOKEN']}"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;


&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;actor&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;run_input&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;max_usd&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="s2"&gt;"""Run an Actor, wait for it to finish (up to 300 s) and return its dataset items."""&lt;/span&gt;
    &lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;post&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;"{API}/{actor}/run-sync-get-dataset-items"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;params&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"maxTotalChargeUsd"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;max_usd&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;headers&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="no"&gt;HEADERS&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;run_input&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;timeout&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;360&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;raise_for_status&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;


&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;process&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;links&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;memory&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"my-archive"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="c1"&gt;# 1. Download every link: one manifest row per link with the type read from the bytes,&lt;/span&gt;
    &lt;span class="c1"&gt;#    the size, the SHA-256 and a signed link to the stored copy.&lt;/span&gt;
    &lt;span class="n"&gt;manifest&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"greenrun~bulk-file-downloader"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"urls"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;links&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;max_usd&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="c1"&gt;# 2. Keep only files whose content no earlier run with the same memory has seen.&lt;/span&gt;
    &lt;span class="n"&gt;new_files&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"greenrun~dataset-merge-dedup"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="s2"&gt;"items"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;manifest&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s2"&gt;"dedupeFields"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"sha256"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s2"&gt;"requiredFields"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"sha256"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s2"&gt;"onlyNew"&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="s2"&gt;"memoryName"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;memory&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="n"&gt;max_usd&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mf"&gt;0.1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="c1"&gt;# 3. Text: images to OCR, documents to Markdown. Both read the stored copies.&lt;/span&gt;
    &lt;span class="n"&gt;source&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"fileUrl"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"url"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;new_files&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="n"&gt;images&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"fileUrl"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;new_files&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"category"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s2"&gt;"image"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="n"&gt;documents&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"fileUrl"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;new_files&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"category"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s2"&gt;"document"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="n"&gt;texts&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="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;images&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;texts&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"greenrun~image-to-text-ocr"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"urls"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;images&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;max_usd&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1&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;documents&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;texts&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"greenrun~document-to-markdown"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"urls"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;documents&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;max_usd&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;item&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;texts&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"source"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;source&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"url"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"url"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;manifest&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;new_files&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;texts&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Call it with your list and keep the memory name the same from run to run:&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="n"&gt;manifest&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;new_files&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;texts&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;process&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;links&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;memory&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"my-archive"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;item&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;texts&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;item&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"source"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"text"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&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="ow"&gt;or&lt;/span&gt; &lt;span class="s2"&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;&lt;code&gt;texts&lt;/code&gt; holds OCR items (with &lt;code&gt;text&lt;/code&gt;) and document items (with &lt;code&gt;markdown&lt;/code&gt;); &lt;code&gt;source&lt;/code&gt; is the original link, added by the function. The synchronous endpoint waits up to 300 seconds and answers 408 if a run takes longer, so for thousands of links start the runs with &lt;code&gt;POST .../runs&lt;/code&gt; and pass the downloader's dataset to the dedup Actor in &lt;code&gt;datasetIds&lt;/code&gt; instead of the rows.&lt;/p&gt;

&lt;h2&gt;
  
  
  Week 1: six links
&lt;/h2&gt;

&lt;p&gt;The first list had three RFC PDFs from rfc-editor.org (12 to 16 pages each), two test images from Tesseract's test suite (&lt;code&gt;phototest.tif&lt;/code&gt; and &lt;code&gt;eurotext.tif&lt;/code&gt;) and one dead link.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The downloader reported &lt;code&gt;Done: 5 of 6 files downloaded (0.8 MB; 5 file and 0 extra-mb events); 1 not found (see RUN-REPORT)&lt;/code&gt;. The dead link cost nothing.&lt;/li&gt;
&lt;li&gt;The dedup step: &lt;code&gt;Done: 5 unique rows written from 6 read; 1 without the required fields (not written)&lt;/code&gt;. The not-found row has no SHA-256, so &lt;code&gt;requiredFields&lt;/code&gt; drops it.&lt;/li&gt;
&lt;li&gt;OCR read both images (mean word confidence 95.5 and 91.3) and Document to Markdown converted all three PDFs.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;An OCR item, shortened (&lt;code&gt;source&lt;/code&gt; is the field the function adds):&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;"status"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"text"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"format"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"tiff"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"width"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;640&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"height"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;480&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"confidence"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;95.5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"wordCount"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;60&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"text"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"This is a lot of 12 point text to test the\nocr code and see if it works on all types\nof file format.\n\nThe quick brown dog jumped over the\nlazy fox. ..."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"lines"&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;"text"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"This is a lot of 12 point text to test the"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nl"&gt;"confidence"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;95.5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
     &lt;span class="nl"&gt;"bbox"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nl"&gt;"x"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;36&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nl"&gt;"y"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;92&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nl"&gt;"width"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;544&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nl"&gt;"height"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nl"&gt;"page"&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;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"billableEvents"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nl"&gt;"image"&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;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"source"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"https://raw.githubusercontent.com/tesseract-ocr/test/main/testing/phototest.tif"&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Week 2: three more links, two new files
&lt;/h2&gt;

&lt;p&gt;The second list repeated the six links and added three: RFC 9239 (new), &lt;code&gt;phototest_2.tif&lt;/code&gt; (new: the same sentences in another font, so different bytes) and RFC 9309 again with &lt;code&gt;?utm_source=newsletter&lt;/code&gt;. The downloader recognized the tracking-parameter copy by its content (signature in &lt;code&gt;fileUrl&lt;/code&gt; shortened):&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;"index"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;9&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"status"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"duplicate"&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://www.rfc-editor.org/rfc/rfc9309.pdf?utm_source=newsletter"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"fileUrl"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"https://api.apify.com/v2/key-value-stores/vJTzibB1Ta2hbr6QA/records/00001-rfc9309.pdf?signature=..."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"detectedType"&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="nl"&gt;"category"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"document"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"sizeBytes"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;177688&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"sha256"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"149bf3e7f8fa21eaab3cfacf425e624cc44aece2547f65b2f43b97d70511ef0d"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"duplicateOf"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"https://www.rfc-editor.org/rfc/rfc9309.pdf"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"error"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Same content (SHA-256) as input 1, stored once"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"billableEvents"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nl"&gt;"file"&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;span class="nl"&gt;"extra-mb"&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="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The dedup step then let through only the two new files: &lt;code&gt;Done: 2 unique rows written from 9 read; 6 seen in earlier runs, 1 without the required fields (not written)&lt;/code&gt;. OCR ran on one image and Document to Markdown on one PDF:&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;"status"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"success"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"format"&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="nl"&gt;"title"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"RFC 9239: Updates to ECMAScript Media Types"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"pageCount"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;13&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"tablesFound"&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;span class="nl"&gt;"ocrPages"&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="nl"&gt;"characters"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;30832&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;"&amp;lt;!-- page 1 --&amp;gt;\n\nStream: Internet Engineering Task Force (IETF)\nRFC: 9239\nObsoletes: 4329\n..."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"billableEvents"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nl"&gt;"document"&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;span class="nl"&gt;"extra-page"&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="nl"&gt;"ocr-page"&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="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each run took 3 to 9 seconds; with the API calls, a week's pipeline finished in about 30 seconds (32 and 29 seconds measured).&lt;/p&gt;

&lt;h2&gt;
  
  
  Skip known links before downloading
&lt;/h2&gt;

&lt;p&gt;The function downloads every link again each week. That catches a file that changed behind the same URL, but every download costs $0.002. For a long list of links that rarely change, drop the known links first with the same dedup Actor, keyed on &lt;code&gt;url&lt;/code&gt; and with its own memory name:&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="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;new_links&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;links&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;memory&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"my-archive-links"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="s2"&gt;"""Drop links that an earlier run with the same memory already let through."""&lt;/span&gt;
    &lt;span class="n"&gt;rows&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"greenrun~dataset-merge-dedup"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="s2"&gt;"items"&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="s2"&gt;"url"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;link&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;link&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;links&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s2"&gt;"dedupeFields"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"url"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s2"&gt;"onlyNew"&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="s2"&gt;"memoryName"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;memory&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="n"&gt;max_usd&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mf"&gt;0.1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;row&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"url"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;row&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;rows&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;


&lt;span class="n"&gt;fresh&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;new_links&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;links&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;fresh&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;manifest&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;new_files&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;texts&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;process&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;fresh&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When it compares links, the dedup Actor ignores http versus https, &lt;code&gt;www.&lt;/code&gt;, trailing slashes and tracking parameters such as &lt;code&gt;utm_*&lt;/code&gt;, &lt;code&gt;gclid&lt;/code&gt; and &lt;code&gt;fbclid&lt;/code&gt;. With the same two lists it let all 6 links through in week 1 and only the 2 new ones in week 2; the &lt;code&gt;?utm_source=newsletter&lt;/code&gt; link was dropped already at this step. The catch: this gate remembers every link it lets through, including links that fail to download and files that later change behind the same URL. Re-check those separately; the manifest gives failed links a status such as &lt;code&gt;not_found&lt;/code&gt;, &lt;code&gt;blocked&lt;/code&gt; or &lt;code&gt;error&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Run it every week
&lt;/h2&gt;

&lt;p&gt;The memory lives in your Apify account (a key-value store named &lt;code&gt;dataset-merge-dedup-&amp;lt;memory name&amp;gt;&lt;/code&gt;), so the script holds no state: run it from cron, GitHub Actions or any other scheduler, and use a new memory name to start from scratch. Links can also come straight from a scraper's dataset: the downloader and the OCR Actor read them from &lt;code&gt;datasetId&lt;/code&gt; and &lt;code&gt;datasetField&lt;/code&gt; (for example &lt;code&gt;images.url&lt;/code&gt;), next to or instead of &lt;code&gt;urls&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  From an AI agent (MCP)
&lt;/h2&gt;

&lt;p&gt;Apify's MCP server can expose just these four Actors as tools:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;https://mcp.apify.com?tools=greenrun/bulk-file-downloader,greenrun/dataset-merge-dedup,greenrun/image-to-text-ocr,greenrun/document-to-markdown
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each tool takes the same input fields as above, and the downloader's manifest gives the agent a &lt;code&gt;fileUrl&lt;/code&gt; for every stored file to pass to the next tool.&lt;/p&gt;

&lt;h2&gt;
  
  
  Respectful by default
&lt;/h2&gt;

&lt;p&gt;The downloader and the OCR Actor respect robots.txt, and none of the four Actors uses proxies, logins or CAPTCHA solving. Document to Markdown downloads only the links you give it, here the stored copies. Nothing is collected beyond the files you list.&lt;/p&gt;

&lt;h2&gt;
  
  
  What it costs
&lt;/h2&gt;

&lt;p&gt;Pay per event, no subscription. Every run starts with a fee of $0.0045 per GB of memory: at the default settings $0.0045 for the downloader and the dedup Actor, $0.009 for the OCR Actor and Document to Markdown. Then:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Bulk File Downloader: $0.002 per file ($2 per 1,000), plus $0.0002 per MB above 10 MB of one file. A copy with the same content is still downloaded, so it is charged; links that are not found, blocked or filtered are free.&lt;/li&gt;
&lt;li&gt;Merge &amp;amp; Deduplicate Datasets: $0.05 per 1,000 rows written, $0.001 per 1,000 rows read, and $0.0002 per started 100,000 keys of only-new memory (at least once per run in only-new mode).&lt;/li&gt;
&lt;li&gt;Image to Text OCR: $0.002 per image read, with or without text ($2 per 1,000); a multi-page TIFF or an image above 12 megapixels counts more. Files that are not images and failed downloads are free.&lt;/li&gt;
&lt;li&gt;Document to Markdown: $0.005 per document of up to 20 PDF pages ($5 per 1,000), $0.0002 per page above 20, and $0.01 per page that needs OCR. Failed downloads and unsupported files are free.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;billableEvents&lt;/code&gt; in each item shows what it was charged for. Our two test weeks would have cost $0.0565 and $0.0503, mostly start fees. For a list of 1,000 links with 50 new files a week (30 images under 12 megapixels and 20 PDFs of up to 20 pages, all under 10 MB), the code above costs $2.19 a week, $1.90 of it for downloading the 950 known links again; with the link gate in front it costs $0.30. You can cap any run with &lt;code&gt;maxTotalChargeUsd&lt;/code&gt; (at least $0.025; $0.05 for the OCR Actor).&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Prices as of 22 November 2026.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  When to use something else
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Direct file links only: the downloader does not open web pages to look for links and does not run JavaScript. To collect links from pages first, run a crawler and point the downloader at its dataset.&lt;/li&gt;
&lt;li&gt;The OCR is Tesseract: clean printed text works well (95.5 on &lt;code&gt;phototest.tif&lt;/code&gt; above), handwriting does not.&lt;/li&gt;
&lt;li&gt;Default size limits: 100 MB per downloaded file, 30 MB per image for OCR and 50 MB per document; each is an input setting.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  More tools from the same toolbox
&lt;/h2&gt;

&lt;p&gt;The same rules apply to all of them: no proxies, logins or CAPTCHA solving, robots.txt respected, pay per result plus the start fee of $0.0045 per GB of run memory, and each one works as an MCP tool the same way. Prices as of 22 November 2026:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Media files&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://apify.com/greenrun/audio-video-transcriber" rel="noopener noreferrer"&gt;Audio and Video Transcription&lt;/a&gt;: open-source Whisper (base model) inside the Actor, no API keys; text with timestamps, SRT and VTT, $0.005 per minute of audio. Silent, failed and blocked files are free.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://apify.com/greenrun/video-frame-extractor" rel="noopener noreferrer"&gt;Video Frame Extractor&lt;/a&gt;: frames at exact timestamps, every N seconds, keyframes or scene changes as JPEG, PNG or WebP, from $0.80 per 1,000 frames, plus $0.012 per started block of full decoding (about a minute of video up to 1080p) when a mode needs it, such as scene changes. Broken links and non-video files are free.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://apify.com/greenrun/video-converter" rel="noopener noreferrer"&gt;Video &amp;amp; Audio Converter&lt;/a&gt;: FFmpeg conversion and compression to MP4 or WebM at 240p to 1080p, video to MP3 and other audio formats, trimming and GIFs; from $0.03 per output minute up to 480p ($0.045 at 720p, $0.08 at 1080p) and $0.002 per minute of output audio. Failed and blocked files are free.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://apify.com/greenrun/image-converter" rel="noopener noreferrer"&gt;Image Converter and Compressor&lt;/a&gt;: JPEG, PNG, WebP, AVIF, GIF or TIFF output, HEIC input, resizing and EXIF and GPS removal, from $1.50 per 1,000 images ($8.00 per 1,000 as AVIF). Not found, blocked and non-image inputs are free.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Web pages&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://apify.com/greenrun/website-to-markdown" rel="noopener noreferrer"&gt;Website to Markdown&lt;/a&gt;: pages and the PDF and Office files they link to as Markdown, plus llms.txt (&lt;a href="https://dev.to/greenrun/turn-a-docs-site-into-llmstxt-and-clean-markdown-pdfs-included-with-one-api-call-i6f"&gt;our first post&lt;/a&gt;), from $2.00 per 1,000 pages and $5.00 per 1,000 documents.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://apify.com/greenrun/website-image-downloader" rel="noopener noreferrer"&gt;Website Image Extractor and Downloader&lt;/a&gt;: every image on a page with its size and alt text, optional download and ZIP, from $3.00 per 1,000 pages listed and $0.80 per 1,000 images downloaded. Failed pages and pages without images are free.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://apify.com/greenrun/website-screenshot" rel="noopener noreferrer"&gt;Website Screenshot API&lt;/a&gt;: full-page or viewport screenshots as PNG, JPEG, WebP or PDF, from $3.00 per 1,000 screenshots. Blocked, missing and unloadable pages are free.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://apify.com/greenrun/url-status-checker" rel="noopener noreferrer"&gt;Bulk URL Status and Redirect Checker&lt;/a&gt;: HTTP status, final URL and the full redirect chain for a list of URLs, from $0.30 per 1,000 URLs. URLs disallowed by robots.txt are free.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Questions, or a file that comes out badly? Open an issue on the &lt;strong&gt;Issues&lt;/strong&gt; tab of the Actor's page with the link.&lt;/p&gt;

</description>
      <category>python</category>
      <category>webscraping</category>
      <category>ocr</category>
      <category>automation</category>
    </item>
    <item>
      <title>Turn a docs site into llms.txt and clean Markdown, PDFs included, with one API call</title>
      <dc:creator>Greenrun</dc:creator>
      <pubDate>Fri, 20 Nov 2026 20:54:42 +0000</pubDate>
      <link>https://dev.to/greenrun/turn-a-docs-site-into-llmstxt-and-clean-markdown-pdfs-included-with-one-api-call-i6f</link>
      <guid>https://dev.to/greenrun/turn-a-docs-site-into-llmstxt-and-clean-markdown-pdfs-included-with-one-api-call-i6f</guid>
      <description>&lt;p&gt;If you feed documentation to a RAG pipeline or an AI agent, you have probably hit this: the HTML pages convert to Markdown fine, but half of the useful content sits in linked files. The installation guide is a PDF, the price list is an Excel sheet, the release notes are a Word document. Most crawlers either skip those files or save them as they are, and you end up writing a second pipeline for documents.&lt;/p&gt;

&lt;p&gt;We built &lt;a href="https://apify.com/greenrun/website-to-markdown" rel="noopener noreferrer"&gt;Website to Markdown&lt;/a&gt; (an Apify Actor, disclosure: we are Greenrun, its authors) to do both in one run. This post shows how to use it from the API, from Python and from an AI agent over MCP, with real output from a run on 19 November 2026.&lt;/p&gt;

&lt;h2&gt;
  
  
  What one run gives you
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;One Markdown item per page&lt;/strong&gt;: the main content only (navigation, footers and cookie banners removed), with headings, lists, tables, code blocks and absolute links. If a site serves its own Markdown to clients that ask for &lt;code&gt;text/markdown&lt;/code&gt;, that version is used.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;One Markdown item per linked document&lt;/strong&gt;: PDF, DOCX, PPTX, XLSX, XLS and EPUB, with tables and page markers.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;llms.txt and llms-full.txt&lt;/strong&gt; in the run's key-value store: an index of everything in the &lt;a href="https://llmstxt.org" rel="noopener noreferrer"&gt;llmstxt.org&lt;/a&gt; format, and all the Markdown in one file.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A crawl report&lt;/strong&gt; listing every skipped URL with the reason (robots.txt, duplicate, empty page, failed request).&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Step 1: run it
&lt;/h2&gt;

&lt;p&gt;You need an Apify account and its API token. This call crawls up to 200 pages under the start URL, converts the documents they link to, and returns the items when the run ends. &lt;code&gt;maxTotalChargeUsd&lt;/code&gt; caps what the run may cost:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl -X POST &lt;span class="s2"&gt;"https://api.apify.com/v2/acts/greenrun~website-to-markdown/run-sync-get-dataset-items?maxTotalChargeUsd=1"&lt;/span&gt; \
  -H &lt;span class="s2"&gt;"Authorization: Bearer $APIFY_TOKEN"&lt;/span&gt; \
  -H &lt;span class="s2"&gt;"Content-Type: application/json"&lt;/span&gt; \
  -d &lt;span class="s1"&gt;'{"startUrls": [{"url": "https://docs.example.com/"}], "maxCrawlPages": 200}'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This synchronous endpoint waits up to 300 seconds and answers 408 if the run takes longer; for bigger crawls start the run with &lt;code&gt;POST .../runs&lt;/code&gt; and read the dataset when it finishes. The input field names follow Apify's Website Content Crawler (&lt;code&gt;startUrls&lt;/code&gt;, &lt;code&gt;maxCrawlPages&lt;/code&gt;, &lt;code&gt;maxCrawlDepth&lt;/code&gt;, &lt;code&gt;includeUrlGlobs&lt;/code&gt;, &lt;code&gt;excludeUrlGlobs&lt;/code&gt;, &lt;code&gt;useSitemaps&lt;/code&gt;), so an input you already have for that crawler works as it is.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: what comes back
&lt;/h2&gt;

&lt;p&gt;A run on 19 November 2026 with two start URLs, a Python course on docs.apify.com and the PDF of RFC 9309, and &lt;code&gt;maxCrawlPages: 3&lt;/code&gt;, finished in 5 seconds with 3 pages and 1 document. A document item, with the text shortened:&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;"url"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"https://www.rfc-editor.org/rfc/rfc9309.pdf"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"document"&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;"RFC 9309: Robots Exclusion Protocol"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nl"&gt;"contentSignal"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;null&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;"&amp;lt;!-- page 1 --&amp;gt;\n\nStream: Internet Engineering Task Force (IETF)\nRFC: 9309 ..."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"document"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nl"&gt;"format"&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="nl"&gt;"pageCount"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;12&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nl"&gt;"pagesProcessed"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;12&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nl"&gt;"tablesFound"&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="nl"&gt;"ocrPages"&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="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"billableEvents"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nl"&gt;"document"&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;span class="nl"&gt;"extra-page"&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="nl"&gt;"ocr-page"&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="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Pages have the same shape with &lt;code&gt;"type": "page"&lt;/code&gt; and the page metadata (&lt;code&gt;canonicalUrl&lt;/code&gt;, &lt;code&gt;description&lt;/code&gt;, &lt;code&gt;languageCode&lt;/code&gt;, Open Graph and so on). The llms.txt written by that run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="gu"&gt;# docs.apify.com and 1 more sites
&lt;/span&gt;
&lt;span class="ge"&gt;&amp;gt; Markdown version of 3 pages and 1 document from docs.apify.com, www.rfc-editor.org.
&lt;/span&gt;
Crawled from https://docs.apify.com/academy/scraping-basics-python, https://www.rfc-editor.org/rfc/rfc9309.pdf on 2026-11-19: 3 pages and 1 document converted to Markdown. The full text of every page is in llms-full.txt next to this file.

&lt;span class="gu"&gt;## docs.apify.com / Academy
&lt;/span&gt;
&lt;span class="k"&gt;- &lt;/span&gt;[Web scraping basics for Python devs](https://docs.apify.com/academy/scraping-basics-python)
&lt;span class="k"&gt;- &lt;/span&gt;[Inspecting web pages with browser DevTools](https://docs.apify.com/academy/scraping-basics-python/devtools-inspecting.md)
&lt;span class="k"&gt;- &lt;/span&gt;[Locating HTML elements on a web page with browser DevTools](https://docs.apify.com/academy/scraping-basics-python/devtools-locating-elements.md)

&lt;span class="gu"&gt;## Documents
&lt;/span&gt;
&lt;span class="k"&gt;- &lt;/span&gt;[RFC 9309: Robots Exclusion Protocol](https://www.rfc-editor.org/rfc/rfc9309.pdf): PDF, 12 pages
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To fetch llms.txt of your last run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl -H &lt;span class="s2"&gt;"Authorization: Bearer $APIFY_TOKEN"&lt;/span&gt; \
  &lt;span class="s2"&gt;"https://api.apify.com/v2/acts/greenrun~website-to-markdown/runs/last/key-value-store/records/llms.txt"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 3: from Python
&lt;/h2&gt;

&lt;p&gt;The same two calls with &lt;code&gt;requests&lt;/code&gt;, ready to drop into an ingestion script:&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="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;

&lt;span class="no"&gt;API&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"https://api.apify.com/v2/acts/greenrun~website-to-markdown"&lt;/span&gt;
&lt;span class="no"&gt;HEADERS&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"Authorization"&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;"Bearer {os.environ['APIFY_TOKEN']}"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="n"&gt;items&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;post&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;"{API}/run-sync-get-dataset-items"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;params&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"maxTotalChargeUsd"&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;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;headers&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="no"&gt;HEADERS&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"startUrls"&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="s2"&gt;"url"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"https://docs.example.com/"&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="s2"&gt;"maxCrawlPages"&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="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;timeout&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;600&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="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;item&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;items&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;item&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="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"url"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;item&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="ow"&gt;or&lt;/span&gt; &lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;llms_txt&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&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;"{API}/runs/last/key-value-store/records/llms.txt"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;headers&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="no"&gt;HEADERS&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;timeout&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;60&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each item's &lt;code&gt;markdown&lt;/code&gt; is ready for your chunker; &lt;code&gt;url&lt;/code&gt; and &lt;code&gt;metadata.title&lt;/code&gt; make good citations.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 4: from an AI agent (MCP)
&lt;/h2&gt;

&lt;p&gt;Point any MCP client at Apify's MCP server with only this Actor as a tool:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;https://mcp.apify.com?tools=greenrun/website-to-markdown
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The agent gets a tool with the same input fields. Two things worth knowing from our tests: the tool returns the run's status and status message, and the agent then reads the items with a second tool call; and to cap the cost of an agent's run, call it through &lt;code&gt;call-actor&lt;/code&gt; with &lt;code&gt;callOptions.maxTotalChargeUsd&lt;/code&gt; (at least $0.025). When a run reaches the cap, it stops cleanly, still writes llms.txt, and its status message gives the cap and how to raise it, so the agent knows there is more to fetch instead of assuming the site ends there.&lt;/p&gt;

&lt;h2&gt;
  
  
  Respectful by default
&lt;/h2&gt;

&lt;p&gt;robots.txt is always respected, including &lt;code&gt;Crawl-delay&lt;/code&gt; and the Content-Signal preference &lt;code&gt;ai-input=no&lt;/code&gt;. There are no proxies, no CAPTCHA solving and no logins. Each item keeps the site's Content-Signal preferences (for example &lt;code&gt;ai-train=no&lt;/code&gt;) in &lt;code&gt;metadata.contentSignal&lt;/code&gt;, so you can honor them downstream.&lt;/p&gt;

&lt;h2&gt;
  
  
  What it costs
&lt;/h2&gt;

&lt;p&gt;Pay per event, no subscription. Each run starts with a fee of $0.0045 per GB of memory, at least one GB ($0.0045 at the default 1 GB). Then you pay $0.002 per saved page ($2 per 1,000 pages) and $0.005 per linked PDF or Office document it downloads and recognizes, including up to 20 PDF pages; each PDF page above 20 costs $0.0002, and OCR, only if you turn it on, $0.01 per page. A very slow or very large page counts one more event for each further started 19.2 GB-seconds of work (a document for each further 48 GB-seconds), and &lt;code&gt;billableEvents&lt;/code&gt; in each item shows what it was charged for.&lt;/p&gt;

&lt;p&gt;Free: pages and documents disallowed by robots.txt or refused by the site, failed requests, empty pages, duplicates and unsupported files. Two exceptions: a page over 1 MB of HTML is charged once downloaded, even if it turns out empty or a duplicate, and a document is charged once its file is recognized, even if it has no text or fails to convert. A crawl that finds only free pages stops once its start fee is used up and lists the URLs it did not try in the crawl report.&lt;/p&gt;

&lt;p&gt;Examples: 500 pages and 20 PDFs of up to 20 pages cost $0.0045 + 500 × $0.002 + 20 × $0.005 = $1.1045. A 120-page PDF costs $0.005 + 100 × $0.0002 = $0.025. You can cap the cost of a run (at least $0.025); at the cap the crawl stops cleanly and still writes llms.txt.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Prices updated on 22 November 2026.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  When to use something else
&lt;/h2&gt;

&lt;p&gt;Pages are fetched over plain HTTP without a browser. Sites that render their content only with JavaScript come back empty: those pages are free, and the crawl stops once its start fee is used up. For such sites, use a browser-based crawler such as Apify's Website Content Crawler.&lt;/p&gt;

&lt;h2&gt;
  
  
  More tools from the same toolbox
&lt;/h2&gt;

&lt;p&gt;The same rules apply to all of them: no proxies, logins or CAPTCHA solving, robots.txt respected (Document to Markdown downloads only the files you link), and pay per result plus a start fee of $0.0045 per started GB of run memory, which is $0.0045 to $0.009 per run at the default settings. Each one works as an MCP tool the same way as above. Prices as of 22 November 2026:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://apify.com/greenrun/document-to-markdown" rel="noopener noreferrer"&gt;Document to Markdown&lt;/a&gt;: PDF, Word, PowerPoint, Excel, EPUB and scans to Markdown with tables and OCR, from $5.00 per 1,000 documents (up to 20 PDF pages each); failed downloads and unsupported files are free.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://apify.com/greenrun/image-to-text-ocr" rel="noopener noreferrer"&gt;Image to Text OCR&lt;/a&gt;: text, Markdown and word positions from PNG, JPEG, TIFF and WebP images, from $2.00 per 1,000 images; failed downloads and files that are not images are free.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://apify.com/greenrun/bulk-file-downloader" rel="noopener noreferrer"&gt;Bulk File Downloader&lt;/a&gt;: a list of URLs to stored files with a manifest (type, size, SHA-256) and an optional ZIP, from $2.00 per 1,000 files (plus $0.0002 per MB above 10 MB of one file); not found, blocked and unreachable links are free.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://apify.com/greenrun/website-screenshot" rel="noopener noreferrer"&gt;Website Screenshot API&lt;/a&gt;: full-page or viewport screenshots as PNG, JPEG, WebP or PDF, from $3.00 per 1,000 screenshots; pages that are blocked, missing or fail to load are free.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://apify.com/greenrun/url-status-checker" rel="noopener noreferrer"&gt;Bulk URL Status and Redirect Checker&lt;/a&gt;: HTTP status, final URL and the full redirect chain for a list of URLs, from $0.30 per 1,000 URLs; URLs disallowed by robots.txt are free.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://apify.com/greenrun/company-hiring-snapshot" rel="noopener noreferrer"&gt;Company Hiring Snapshot&lt;/a&gt;: open roles of a company from its public Greenhouse, Lever or Ashby board, from $30.00 per 1,000 companies; companies without a public board are free.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://apify.com/greenrun/shopify-store-snapshot" rel="noopener noreferrer"&gt;Shopify Store Snapshot&lt;/a&gt;: catalog size, prices and new products of a Shopify store from its public catalog, from $30.00 per 1,000 stores; sites that are not Shopify stores or block automated access are free.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Questions or a page that converts badly? Open an issue on the &lt;strong&gt;Issues&lt;/strong&gt; tab of &lt;a href="https://apify.com/greenrun/website-to-markdown" rel="noopener noreferrer"&gt;the Actor's page&lt;/a&gt; with the URL.&lt;/p&gt;

</description>
      <category>rag</category>
      <category>llm</category>
      <category>ai</category>
      <category>python</category>
    </item>
  </channel>
</rss>
