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,
  };
};

相關資料來源