Xboard 套餐信息提取器 API

API 端点

1. 生成图片 HTML

GET /api/generate-image?url={xboard_site_url}&format={html|json}

获取可用于截图的完整 HTML 页面或 JSON 数据

2. 获取原始数据

GET /api/get-data?url={xboard_site_url}

仅获取套餐和配置数据的 JSON 格式

使用示例

获取 HTML (用于截图)

https://your-worker.your-subdomain.workers.dev/api/generate-image?url=example.com

获取 JSON 数据

https://your-worker.your-subdomain.workers.dev/api/generate-image?url=example.com&format=json

仅获取原始数据

https://your-worker.your-subdomain.workers.dev/api/get-data?url=example.com

客户端截图示例

// JavaScript 截图示例
  async function captureImage(siteUrl) {
      const response = await fetch(`/api/generate-image?url=${siteUrl}`);
      const html = await response.text();
      
      // 使用 html2canvas 或类似库生成图片
      const canvas = await html2canvas(document.body);
      const imageUrl = canvas.toDataURL('image/png');
      
      return imageUrl;
  }