@@ -1429,6 +1429,7 @@ def web_crawl_md(
14291429 pdf : web_web_crawl_md_params .Pdf | Omit = omit ,
14301430 settle_animations : bool | Omit = omit ,
14311431 shorten_base64_images : bool | Omit = omit ,
1432+ source_preference : List [Literal ["html-conversion" , "markdown-direct" ]] | Omit = omit ,
14321433 stop_after_ms : int | Omit = omit ,
14331434 tags : SequenceNotStr [str ] | Omit = omit ,
14341435 timeout_opts : web_web_crawl_md_params .TimeoutOpts | Omit = omit ,
@@ -1465,9 +1466,11 @@ def web_crawl_md(
14651466 include_frames: When true, the contents of iframes are rendered to Markdown for each crawled
14661467 page.
14671468
1468- include_images: Include image references in the Markdown output
1469+ include_images: Include image references in the Markdown output Only applies to
1470+ `html-conversion` extractions.
14691471
1470- include_links: Preserve hyperlinks in the Markdown output
1472+ include_links: Preserve hyperlinks in the Markdown output Only applies to `html-conversion`
1473+ extractions.
14711474
14721475 include_selectors: Keep matching HTML subtrees before converting each page to Markdown.
14731476
@@ -1482,7 +1485,18 @@ def web_crawl_md(
14821485 settle_animations: Wait briefly for CSS animations and transitions to settle before reading each
14831486 page.
14841487
1485- shorten_base64_images: Truncate base64-encoded image data in the Markdown output
1488+ shorten_base64_images: Truncate base64-encoded image data in the Markdown output Only applies to
1489+ `html-conversion` extractions.
1490+
1491+ source_preference: Where the Markdown should come from, in order of preference; the first usable
1492+ source wins. `html-conversion` converts the page HTML, and counts as unusable
1493+ when the conversion has almost no content (under 200 characters).
1494+ `markdown-direct` uses the official Markdown version the page publishes through,
1495+ returned as the site serves it. Defaults to
1496+ `["html-conversion", "markdown-direct"]`. With only `markdown-direct`, a page
1497+ that publishes no Markdown fails with `NO_PUBLISHED_MARKDOWN` and is not billed.
1498+ Requests with include or exclude selectors never use `markdown-direct`, so they
1499+ must include `html-conversion`.
14861500
14871501 stop_after_ms: Soft crawl deadline in milliseconds. Returns pages collected before the next
14881502 deadline check.
@@ -1531,6 +1545,7 @@ def web_crawl_md(
15311545 "pdf" : pdf ,
15321546 "settle_animations" : settle_animations ,
15331547 "shorten_base64_images" : shorten_base64_images ,
1548+ "source_preference" : source_preference ,
15341549 "stop_after_ms" : stop_after_ms ,
15351550 "tags" : tags ,
15361551 "timeout_opts" : timeout_opts ,
@@ -2937,6 +2952,7 @@ async def web_crawl_md(
29372952 pdf : web_web_crawl_md_params .Pdf | Omit = omit ,
29382953 settle_animations : bool | Omit = omit ,
29392954 shorten_base64_images : bool | Omit = omit ,
2955+ source_preference : List [Literal ["html-conversion" , "markdown-direct" ]] | Omit = omit ,
29402956 stop_after_ms : int | Omit = omit ,
29412957 tags : SequenceNotStr [str ] | Omit = omit ,
29422958 timeout_opts : web_web_crawl_md_params .TimeoutOpts | Omit = omit ,
@@ -2973,9 +2989,11 @@ async def web_crawl_md(
29732989 include_frames: When true, the contents of iframes are rendered to Markdown for each crawled
29742990 page.
29752991
2976- include_images: Include image references in the Markdown output
2992+ include_images: Include image references in the Markdown output Only applies to
2993+ `html-conversion` extractions.
29772994
2978- include_links: Preserve hyperlinks in the Markdown output
2995+ include_links: Preserve hyperlinks in the Markdown output Only applies to `html-conversion`
2996+ extractions.
29792997
29802998 include_selectors: Keep matching HTML subtrees before converting each page to Markdown.
29812999
@@ -2990,7 +3008,18 @@ async def web_crawl_md(
29903008 settle_animations: Wait briefly for CSS animations and transitions to settle before reading each
29913009 page.
29923010
2993- shorten_base64_images: Truncate base64-encoded image data in the Markdown output
3011+ shorten_base64_images: Truncate base64-encoded image data in the Markdown output Only applies to
3012+ `html-conversion` extractions.
3013+
3014+ source_preference: Where the Markdown should come from, in order of preference; the first usable
3015+ source wins. `html-conversion` converts the page HTML, and counts as unusable
3016+ when the conversion has almost no content (under 200 characters).
3017+ `markdown-direct` uses the official Markdown version the page publishes through,
3018+ returned as the site serves it. Defaults to
3019+ `["html-conversion", "markdown-direct"]`. With only `markdown-direct`, a page
3020+ that publishes no Markdown fails with `NO_PUBLISHED_MARKDOWN` and is not billed.
3021+ Requests with include or exclude selectors never use `markdown-direct`, so they
3022+ must include `html-conversion`.
29943023
29953024 stop_after_ms: Soft crawl deadline in milliseconds. Returns pages collected before the next
29963025 deadline check.
@@ -3039,6 +3068,7 @@ async def web_crawl_md(
30393068 "pdf" : pdf ,
30403069 "settle_animations" : settle_animations ,
30413070 "shorten_base64_images" : shorten_base64_images ,
3071+ "source_preference" : source_preference ,
30423072 "stop_after_ms" : stop_after_ms ,
30433073 "tags" : tags ,
30443074 "timeout_opts" : timeout_opts ,
0 commit comments