Source Code
version: 1.0.0
name: 金十数据
description: 金十数据快讯
author: codytseng
author_url: https://github.com/codytseng
category: Finance
tags:
- finance
- news
- chinese
- market 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,
};
}; 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,
};
}; Related Sources
CoinGecko Crypto Markets
FinanceTop cryptocurrencies by market cap from CoinGecko
#crypto #finance #markets
Finnhub Market News
FinanceFinancial news aggregated from major sources like Yahoo, Reuters, and CNBC via Finnhub
#finance #news #market #stocks
Stock Price Monitor
FinanceMonitor global stock prices in your menu bar. Displays real-time price, change amount, and change percentage. Powered by Finnhub (free API key required).
#stock #finance #market
华尔街见闻
Finance华尔街见闻 7x24 快讯
#finance #news #chinese #market