nbinlineai.web_tools
Read bounded public HTTP or HTTPS pages for opt-in notebook tools.
This helper fetches public text pages. It does not use a browser session, notebook context, provider keys, cookies, or an HTTP proxy.
fetch_url_markdown
fetch_url_markdown(url: str, selector: str = '', extract_section: bool = False) -> strFetch a public page as short, source-attributed Markdown.
Accept HTML, plain text, and Markdown. Recheck the destination after each of at most three redirects, and reject HTTPS to HTTP downgrades. A CSS selector applies to HTML only. The original URL fragment selects a section when requested. The output contains at most 8,000 characters.
| Parameter | Type | Default | Description |
|---|---|---|---|
url |
str | required | Public HTTP or HTTPS page, without URL credentials. |
selector |
str | '' |
Optional CSS selector for one HTML element or heading section. |
extract_section |
bool | False |
Use the original URL fragment when selector is empty. |
| returns | str | Bounded source-attributed Markdown excerpt. |
read_url_section
read_url_section(url: str, selector: str = '') -> strRead one public page section using a CSS selector or URL fragment.
A selected heading includes following siblings through the next heading at the same or a higher level. The result includes the source URL.
| Parameter | Type | Default | Description |
|---|---|---|---|
url |
str | required | Public page URL, optionally with a section fragment. |
selector |
str | '' |
CSS selector for one HTML element or heading section. |
| returns | str | Bounded source-attributed section text. |