> ## Documentation Index
> Fetch the complete documentation index at: https://ikun.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Newspaper4k

**Newspaper4k** 使 Agent 能够使用 Newspaper4k 库阅读新闻文章。

## 先决条件

以下示例需要 `newspaper4k` 和 `lxml_html_clean` 库。

```shell theme={null}
pip install -U newspaper4k lxml_html_clean
```

## 实战示例

以下 Agent 将总结文章：[https://www.rockymountaineer.com/blog/experience-icefields-parkway-scenic-drive-lifetime。](https://www.rockymountaineer.com/blog/experience-icefields-parkway-scenic-drive-lifetime。)

```python cookbook/tools/newspaper4k_tools.py theme={null}
from agno.agent import Agent
from agno.tools.newspaper4k import Newspaper4kTools

agent = Agent(tools=[Newspaper4kTools()], debug_mode=True, show_tool_calls=True)
agent.print_response("Please summarize https://www.rockymountaineer.com/blog/experience-icefields-parkway-scenic-drive-lifetime")
```

## Toolkit 参数

| 参数                | 类型     | 默认值     | 描述                   |
| ----------------- | ------ | ------- | -------------------- |
| `read_article`    | `bool` | `True`  | 启用读取文章全文的功能。         |
| `include_summary` | `bool` | `False` | 指定是否在返回全文的同时包含文章的摘要。 |
| `article_length`  | `int`  | -       | 要处理或返回的文章或其摘要的最大长度。  |

## Toolkit 函数

| 函数                 | 描述             |
| ------------------ | -------------- |
| `get_article_data` | 此函数读取文章的全文和数据。 |
| `read_article`     | 此函数读取文章的全文。    |

## 开发者资源

* 查看 [Tools](https://github.com/agno-agi/agno/blob/main/libs/agno/agno/tools/newspaper4k.py)
* 查看 [Cookbook](https://github.com/agno-agi/agno/blob/main/cookbook/tools/newspaper4k_tools.py)
