Glanceway Glanceway
所有信息源

金十数据

财经 v1.0.0

金十数据快讯

@codytseng #finance #news #chinese #market

安装与配置方法

  1. 先在 Mac 上安装并打开 Glanceway,再使用上方的安装链接。
  2. 点击“安装到 Glanceway”。如果浏览器无法唤起应用,下载 .gwsrc 文件并在信息源管理中导入。
  3. 填写下列必填字段并保存,设置刷新间隔,等待首次成功获取。

当前版本没有必填配置字段,安装后等待首次获取即可。

没有显示内容时如何排查

  • 对照当前版本配置表核对字段、列表项和凭据。下方示例不包含可用的真实凭据。
  • 检查网络与上游服务状态。认证失败或速率限制可能导致刷新失败,应根据上游限制调整间隔。
  • 空列表也可能表示没有符合条件的条目。内容和更新时间取决于数据提供方及信息源实现。

源代码

id: codytseng/jin10
version: 1.0.0
name: 金十数据
description: 金十数据快讯
author: codytseng
author_url: https://github.com/codytseng
category: Finance
tags:
  - finance
  - news
  - chinese
  - market
function stripHtml(html) {
  return html.replace(/<[^>]*>/g, "").trim();
}

module.exports = async (api) => {
  async function fetchData() {
    const response = await api.fetch(
      "https://flash-api.jin10.com/get_flash_list?channel=-8200&vip=1",
      {
        headers: {
          "x-app-id": "bVBF4FyRTn5NJF5n",
          "x-version": "1.0.0",
        },
      },
    );

    if (!response.ok || !response.json) {
      throw new Error(`Failed to fetch Jin10 flash news (HTTP ${response.status})`);
    }

    const items = [];

    for (const item of response.json.data) {
      if (item.type === 1) {
        continue;
      }

      let title;
      let url;

      if (item.type === 2) {
        title = item.data.title ?? "";
        url = item.data.link;
      } else {
        const content = stripHtml(item.data.content ?? "");
        const match = content.match(/【(.+?)】/);
        title = match ? match[1] : content;
        url = "https://www.jin10.com/flash";
      }

      if (!title) {
        continue;
      }

      items.push({
        id: item.id,
        title,
        subtitle: stripHtml(item.data.content ?? ""),
        url,
        timestamp: item.time,
      });
    }

    api.emit(items);
  }

  await fetchData();

  return {
    refresh: fetchData,
  };
};

相关信息源