fetch
Retrieve web content from URLs with flexible output options including raw HTML, filtered content, or Markdown conversion for text extraction and processing.
Instructions
获取网页内容。 - 如果是 HTML, 则根据 returm 返回合适的内容, - 如果不是 HTML,但是是 Text 或 Json 内容,则直接返回其内容。 - 如果是其它类型的内容,则返回错误信息。
Args:
url (str): 要获取的网页 URL。
return_content ("raw" | "basic_clean" | "strict_clean" | "markdown", optional): 默认为 "markdown",用于控制返回 html 内容的方式,
- 如果为 raw,返回原始 HTML 内容。
- 如果为 basic_clean,返回过滤后的 HTML 内容,过滤掉所有不会显示的标签,如 script, style 等。
- 如果为 strict_clean,返回过滤后的 HTML 内容,过滤掉所有不会显示的标签,如 script, style 等,并且会删除大部分无用的 HTML 属性。
- 如果为 markdown,HTML 转换为 Markdown 后返回。
Returns:
- 如果 return_content 为 raw,返回原始 HTML 内容。
- 如果 return_content 为 basic_clean,返回过滤后的 HTML 内容,过滤掉所有不会显示的标签,如 script, style 等。
- 如果 return_content 为 strict_clean,返回过滤后的 HTML 内容,过滤掉所有不会显示的标签,如 script, style 等,并且会删除大部分无用的 HTML 属性。
- 如果 return_content 为 markdown,HTML 转换为 Markdown 后返回。
Input Schema
Name | Required | Description | Default |
---|---|---|---|
return_content | No | markdown | |
url | Yes |
Input Schema (JSON Schema)
{
"properties": {
"return_content": {
"default": "markdown",
"enum": [
"raw",
"basic_clean",
"strict_clean",
"markdown"
],
"title": "Return Content",
"type": "string"
},
"url": {
"title": "Url",
"type": "string"
}
},
"required": [
"url"
],
"title": "fetchArguments",
"type": "object"
}