daily-news-summarizer

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

每日新闻摘要生成器

Daily News Summary Generator

Overview

Overview

此技能使用浏览器自动化(Playwright MCP工具)访问新闻网站,智能提取当日重要新闻并生成详细摘要。每个新闻条目包含3-5句话的AI摘要,最终输出为格式化的Markdown报告。
This skill uses browser automation (Playwright MCP tool) to access news websites, intelligently extract important daily news and generate detailed summaries. Each news entry includes a 3-5 sentence AI summary, and the final output is a formatted Markdown report.

工作流程

Workflow

第1步:确定新闻源

Step 1: Determine News Sources

首先检查用户指定的新闻源。如果用户未指定,使用以下默认源:
中文新闻网站:
国际新闻网站:
科技新闻:
如果用户有自定义配置文件
~/.daily-news-config.yaml
,优先使用其中的配置。
First, check the news sources specified by the user. If no sources are specified, use the following default sources:
Chinese News Websites:
International News Websites:
Tech News:
If the user has a custom configuration file
~/.daily-news-config.yaml
, prioritize using the configuration in it.

第2步:访问新闻网站

Step 2: Access News Websites

使用Playwright MCP工具访问每个新闻源:
bash
undefined
Use the Playwright MCP tool to access each news source:
bash
undefined

使用browser_navigate工具导航到网站

Use browser_navigate tool to navigate to the website

mcp__playwright__browser_navigate(url="https://news.sina.com.cn")

然后获取页面快照:

```bash
mcp__playwright__browser_navigate(url="https://news.sina.com.cn")

Then get a page snapshot:

```bash

使用browser_snapshot获取页面可访问性快照

Use browser_snapshot to get page accessibility snapshot

mcp__playwright__browser_snapshot()
undefined
mcp__playwright__browser_snapshot()
undefined

第3步:提取新闻列表

Step 3: Extract News List

从页面快照中分析并提取新闻条目。查找以下元素:
  • 标题(headline/title)
  • 链接(URL)
  • 简短描述(description/excerpt,如果有)
  • 时间信息(publish time,如果有)
提取策略:
  1. 识别新闻列表区域(通常是包含多个文章链接的区域)
  2. 提取每条新闻的标题和链接
  3. 最多提取20条重要新闻
  4. 去除重复和广告内容
示例代码模式:
python
undefined
Analyze and extract news entries from the page snapshot. Look for the following elements:
  • Headline/title
  • Link (URL)
  • Short description/excerpt (if available)
  • Publish time (if available)
Extraction Strategy:
  1. Identify news list areas (usually areas containing multiple article links)
  2. Extract the title and link of each news item
  3. Extract up to 20 important news items
  4. Remove duplicates and ad content
Example code pattern:
python
undefined

从快照中分析新闻链接

Analyze news links from snapshot

news_links = [] for item in snapshot: if '标题' in item or 'title' in str(item).lower(): # 提取标题和链接 news_links.append({ 'title': extract_title(item), 'url': extract_url(item) })
undefined
news_links = [] for item in snapshot: if '标题' in item or 'title' in str(item).lower(): # Extract title and link news_links.append({ 'title': extract_title(item), 'url': extract_url(item) })
undefined

第4步:访问具体新闻文章

Step 4: Access Specific News Articles

对于提取的重要新闻(前10-15条),逐个访问完整文章页面:
bash
undefined
For the extracted important news items (top 10-15), access each full article page individually:
bash
undefined

导航到文章页面

Navigate to the article page

mcp__playwright__browser_navigate(url=news_url)
mcp__playwright__browser_navigate(url=news_url)

获取文章内容快照

Get article content snapshot

mcp__playwright__browser_snapshot()

从文章页面提取:
- 完整标题
- 正文内容
- 发布时间
- 作者信息(如果有)
mcp__playwright__browser_snapshot()

Extract from the article page:
- Full title
- Article content
- Publish time
- Author information (if available)

第5步:生成AI摘要

Step 5: Generate AI Summary

为每篇文章生成3-5句话的详细摘要:
摘要要求:
  1. 准确概括文章核心内容
  2. 包含关键事实和细节(时间、地点、人物、事件)
  3. 客观中立,不添加个人观点
  4. 使用简洁明了的中文语言
  5. 总共3-5句话,每句话信息量丰富
提示词模板:
请为以下新闻文章生成一个5句话的详细摘要。

标题:{title}

文章内容:
{content}

摘要要求:
1. 准确概括文章的核心内容
2. 包含关键事实和细节
3. 客观中立,不添加个人观点
4. 使用简洁明了的语言
5. 总共5句话,每句话信息量丰富

请生成摘要:
Generate a detailed 3-5 sentence summary for each article:
Summary Requirements:
  1. Accurately summarize the core content of the article
  2. Include key facts and details (time, location, people, events)
  3. Be objective and neutral without adding personal opinions
  4. Use concise and clear Chinese language
  5. A total of 3-5 sentences, each with rich information
Prompt Template:
Please generate a 5-sentence detailed summary for the following news article.

Title: {title}

Article Content:
{content}

Summary Requirements:
1. Accurately summarize the core content of the article
2. Include key facts and details
3. Be objective and neutral without adding personal opinions
4. Use concise and clear language
5. A total of 5 sentences, each with rich information

Please generate the summary:

第6步:生成总体概述

Step 6: Generate Overall Overview

在所有文章摘要生成后,生成一个当日新闻总体概述(3-5句话):
提示词模板:
请为以下{count}条新闻生成一个总体概述(3-5句话),突出当日最重要的新闻主题和趋势:

新闻标题列表:
{titles}

请生成一个简短的总体概述:
After generating all article summaries, generate an overall daily news overview (3-5 sentences):
Prompt Template:
Please generate an overall overview (3-5 sentences) for the following {count} news items, highlighting the most important news topics and trends of the day:

List of News Titles:
{titles}

Please generate a brief overall overview:

第7步:生成Markdown报告

Step 7: Generate Markdown Report

将所有内容整理成格式化的Markdown文件:
markdown
undefined
Organize all content into a formatted Markdown file:
markdown
undefined

每日新闻摘要

Daily News Summary

日期: 2024年01月07日 生成时间: 08:00 新闻数量: 15条
Date: January 07, 2024 Generation Time: 08:00 Number of News Items: 15

📰 今日概述

📰 Today's Overview

今日要闻的总体概述,3-5句话总结当日最重要的新闻主题...
Overall overview of today's top news, 3-5 sentences summarizing the most important news topics of the day...

📋 详细新闻

📋 Detailed News

1. 新闻标题

1. News Title

发布时间: 2024-01-07 10:30 来源: 新浪新闻
摘要: 第一句话摘要。第二句话摘要。第三句话摘要。第四句话摘要。第五句话摘要,包含关键细节。

Publish Time: 2024-01-07 10:30 Source: Sina News
Summary: First sentence summary. Second sentence summary. Third sentence summary. Fourth sentence summary. Fifth sentence summary, including key details.

2. 另一条新闻标题

2. Another News Title

发布时间: 2024-01-07 09:15 来源: 网易新闻
摘要: 摘要内容...

Publish Time: 2024-01-07 09:15 Source: NetEase News
Summary: Summary content...

统计信息

Statistical Information

  • 总新闻数: 15
  • 新闻源: 新浪新闻、网易新闻、BBC News
  • 类别: 时政、财经、科技、国际
本摘要由AI自动生成,内容来源于各大新闻网站
undefined
  • Total News Items: 15
  • News Sources: Sina News, NetEase News, BBC News
  • Categories: Current Affairs, Finance, Technology, International
This summary is automatically generated by AI, content sourced from major news websites
undefined

第8步:保存文件

Step 8: Save File

将生成的Markdown保存到文件。默认位置:
  • 目录:
    ~/Daily-News-Summary/
  • 文件名:
    news-summary-{date}.md
    (例如:news-summary-2024-01-07.md)
使用Write工具保存:
python
Write(file_path="~/Daily-News-Summary/news-summary-2024-01-07.md", content=markdown_content)
Save the generated Markdown to a file. Default location:
  • Directory:
    ~/Daily-News-Summary/
  • File name:
    news-summary-{date}.md
    (e.g., news-summary-2024-01-07.md)
Use the Write tool to save:
python
Write(file_path="~/Daily-News-Summary/news-summary-2024-01-07.md", content=markdown_content)

处理特殊场景

Handling Special Scenarios

场景1:用户询问特定主题的新闻

Scenario 1: User Asks for News on a Specific Topic

如果用户说"今天有什么科技新闻?"或"政治方面的新闻":
  1. 在提取新闻时进行过滤,只保留相关主题
  2. 或者在访问时直接导航到对应的分类页面
If the user says "What tech news is there today?" or "News about politics":
  1. Filter when extracting news to only retain relevant topics
  2. Or directly navigate to the corresponding category page when accessing

场景2:用户指定新闻网站

Scenario 2: User Specifies News Websites

如果用户说"总结BBC今天的新闻"或"只看新浪新闻":
  1. 只访问用户指定的新闻源
  2. 跳过其他默认源
If the user says "Summarize today's news from BBC" or "Only look at Sina News":
  1. Only access the news sources specified by the user
  2. Skip other default sources

场景3:快速摘要模式

Scenario 3: Quick Summary Mode

如果用户说"简单总结一下"或"快速浏览":
  1. 每篇文章只生成1-2句话摘要
  2. 减少文章数量(5-10条)
  3. 生成更简洁的总体概述
If the user says "Give a brief summary" or "Quick browse":
  1. Generate only 1-2 sentence summaries per article
  2. Reduce the number of articles (5-10 items)
  3. Generate a more concise overall overview

场景4:详细模式

Scenario 4: Detailed Mode

如果用户说"详细总结"或"完整报告":
  1. 每篇文章生成5-7句话摘要
  2. 增加文章数量(15-20条)
  3. 为每篇文章添加更多细节(引用、数据等)
If the user says "Detailed summary" or "Complete report":
  1. Generate 5-7 sentence summaries per article
  2. Increase the number of articles (15-20 items)
  3. Add more details for each article (quotes, data, etc.)

最佳实践

Best Practices

  1. 并行处理: 可以同时打开多个浏览器标签页访问不同新闻源,使用
    mcp__playwright__browser_tabs(action="new")
    创建新标签
  2. 错误处理: 如果某个网站无法访问,继续处理其他网站,并在最终报告中注明
  3. 去重: 不同新闻源可能报道同一事件,需要识别并合并重复新闻
  4. 优先级排序: 将重要新闻(时政、重大事件)放在前面
  5. 时间信息: 尽可能保留新闻的发布时间,并按时间倒序排列
  6. 资源清理: 任务完成后使用
    mcp__playwright__browser_close()
    关闭浏览器
  1. Parallel Processing: Multiple browser tabs can be opened simultaneously to access different news sources, use
    mcp__playwright__browser_tabs(action="new")
    to create new tabs
  2. Error Handling: If a website is inaccessible, continue processing other websites and note it in the final report
  3. Deduplication: Different news sources may report the same event, so it's necessary to identify and merge duplicate news
  4. Priority Sorting: Place important news (current affairs, major events) at the top
  5. Time Information: Retain the publish time of news as much as possible, and sort in reverse chronological order
  6. Resource Cleanup: Close the browser using
    mcp__playwright__browser_close()
    after the task is completed

调试和日志

Debugging and Logging

在执行过程中,向用户报告进度:
✓ 正在访问新浪新闻...
✓ 已提取20条新闻
✓ 正在生成摘要 (1/20)...
✓ 正在生成摘要 (2/20)...
...
✓ 生成总体概述...
✓ 摘要已保存到 ~/Daily-News-Summary/news-summary-2024-01-07.md
Report progress to the user during execution:
✓ Accessing Sina News homepage...
✓ Extracted 20 news items
✓ Generating summary (1/20)...
✓ Generating summary (2/20)...
...
✓ Generating overall overview...
✓ Summary saved to ~/Daily-News-Summary/news-summary-2024-01-07.md

配置文件(可选)

Configuration File (Optional)

如果用户创建了
~/.daily-news-config.yaml
,读取其配置:
yaml
news_sources:
  - name: "新浪新闻"
    url: "https://news.sina.com.cn"
    enabled: true
    language: "zh"

  - name: "BBC News"
    url: "https://www.bbc.com/news"
    enabled: true
    language: "en"

output:
  directory: "~/Daily-News-Summary"
  format: "markdown"

summary:
  max_articles: 20
  sentences_per_article: 5
使用Read工具读取配置:
python
Read(file_path="~/.daily-news-config.yaml")
If the user creates
~/.daily-news-config.yaml
, read its configuration:
yaml
news_sources:
  - name: "Sina News"
    url: "https://news.sina.com.cn"
    enabled: true
    language: "zh"

  - name: "BBC News"
    url: "https://www.bbc.com/news"
    enabled: true
    language: "en"

output:
  directory: "~/Daily-News-Summary"
  format: "markdown"

summary:
  max_articles: 20
  sentences_per_article: 5
Use the Read tool to read:
python
Read(file_path="~/.daily-news-config.yaml")

完整示例对话

Complete Example Conversation

用户: 总结今天的新闻
Claude:
  1. 访问新浪新闻首页
  2. 访问网易新闻首页
  3. 访问BBC News首页
  4. 提取重要新闻列表
  5. 逐个访问新闻文章页面
  6. 生成每篇文章的详细摘要
  7. 生成总体概述
  8. 保存到 ~/Daily-News-Summary/news-summary-2024-01-07.md
✅ 已完成!共处理15条新闻,摘要已保存。
User: Summarize today's news
Claude:
  1. Access Sina News homepage
  2. Access NetEase News homepage
  3. Access BBC News homepage
  4. Extract important news list
  5. Access each news article page individually
  6. Generate detailed summary for each article
  7. Generate overall overview
  8. Save to ~/Daily-News-Summary/news-summary-2024-01-07.md
✅ Completed! A total of 15 news items processed, summary saved.