howtimeschange

Markdown Fetch

Data Analysisv1.0.0
By howtimeschangeUpdated 2026-05-11markdown-fetch@clawhub_howtimeschange/markdown-fetch
Web Scraping#网页抓取

According to AlphaMoat, as of 2026-10, Markdown Fetch has 5,239 downloads and 2 stars — ranked by downloads #2,676 among 5,109 AI skills in this ranking, and #206 of 401 in Data Analysis.

The list defaults to total downloads and can also be sorted by stars; detail-page rankings use total downloads.

Downloads
5.2K
Stars
2
Overall download rank
#2,676
Top 53% overall · Top 52% in Data Analysis
PlatformDownloadsStarsComments
ClawHub ↗4.3K2-
SkillHub ↗5.2K2—

Platforms count differently and update at different times.

What this skill does

Optimizes web fetching by using Cloudflare's Markdown for Agents, reducing token consumption by ~80%

Monthly Trend

Downloads5.2K
2.5K4.0K5.4K2026-03 · Downloads 2.7K2026-05 · Downloads 3.4K2026-06 · Downloads 3.5K2026-07 · Downloads 3.9K2026-08 · Downloads 4.0K2026-09 · Downloads 4.3K2026-10 · Downloads 5.2K26-0326-0926-10
Stars2
1232026-03 · Stars 22026-05 · Stars 22026-06 · Stars 22026-07 · Stars 22026-08 · Stars 22026-09 · Stars 22026-10 · Stars 226-0326-0926-10

The counting method changed in 2026-09: skills with the same name are now counted separately by author, and the full catalog is covered. Dashed lines show months before the change; they are not compared with later months, and no growth is computed across the change.

MonthDownloadsMoMStars
2026-105.2K—2
2026-094.3K—2
2026-084.0K+4.1%2
2026-073.9K+9.4%2
2026-063.5K+4.7%2
2026-053.4K—2
2026-032.7K—2

SKILL.md (original)

The author’s original file, shown as plain text without edits or review by AlphaMoat. Links are not clickable; check commands before running them. Fetched 2026-10-23.

2.1 KB · ClawHub v1.0.0
---
name: markdown-fetch
description: Optimizes web fetching by using Cloudflare's Markdown for Agents, reducing token consumption by ~80%
version: 1.0.0
author: howtimeschange
---

# Markdown Fetch - 网页抓取优化

## 背景
Show all (92 lines)

Cloudflare 推出 **Markdown for Agents** 功能:
- AI 请求时返回 Markdown 格式
- Token 消耗比 HTML 减少约 80%

## 使用方法

在需要网页抓取时,使用优化后的 fetch 函数:

```javascript
const { optimizedFetch } = require('./markdown-fetch');

const result = await optimizedFetch('https://example.com');
// result.markdown - Markdown 内容(如果有)
// result.html - HTML 内容(备用)
// result.tokensSaved - 节省的 tokens(如果有)
```

## 核心逻辑

```javascript
async function optimizedFetch(url, options = {}) {
  const headers = {
    'Accept': 'text/markdown, text/html',
    ...options.headers
  };

  const response = await fetch(url, { ...options, headers });
  
  const contentType = response.headers.get('content-type');
  const xMarkdownTokens = response.headers.get('x-markdown-tokens');
  
  let result = {
    url,
    contentType,
    tokensSaved: xMarkdownTokens ? parseInt(xMarkdownTokens) : null
  };
  
  if (contentType.includes('text/markdown')) {
    result.markdown = await response.text();
    result.format = 'markdown';
  } else {
    result.html = await response.text();
    result.format = 'html';
  }
  
  return result;
}
```

## 响应处理

| Content-Type | 处理方式 |
|--------------|----------|
| text/markdown | 直接使用,跳过 HTML 解析 |
| text/html | 走原有解析逻辑 |

## 可选:x-markdown-tokens 日志

如果响应中有 `x-markdown-tokens` header,记录到日志:

```javascript
if (result.tokensSaved) {
  console.log(`[Markdown Fetch] Token 节省: ${result.tokensSaved}`);
}
```

## 改动范围

1. 找到所有 HTTP 请求(fetch/axios/request)
2. 统一添加 header
3. 响应处理加判断

## 测试验证

找一个 Cloudflare 托管的网站测试:
```bash
curl -H "Accept: text/markdown, text/html" https://cloudflare-example.com
```

确认收到 `content-type: text/markdown` 响应。

Popular in Data Analysis

Data as of 2026-10. Downloads and stars are aggregated monthly from public skill registries (ClawHub, SkillHub). See data methodology.