灵猴市集Linghou Market

通达信热搜榜

通达信tdx-hot-rank

用途 读取通达信热搜榜页面中的热门股票列表,返回排名、代码、名称、涨跌幅、热度和标签。 执行前提 请先打开通达信热搜榜页面,或 pul.tdx.com.cn 域名下的页面:https://pul.tdx.com.cn/site/app/gzhbd/tdx-topsearch/page-main.html?pageName=page_topsearch&ta…

热搜榜单股票
版本1.0.0
扫描passed
更新2026-06-28
超时30000ms

匹配范围

*://pul.tdx.com.cn/*

排除范围

未声明

能力声明

dom.read

代码

源码已展开
1return await (async () => {2  const targetUrl = "https://pul.tdx.com.cn/site/app/gzhbd/tdx-topsearch/page-main.html?pageName=page_topsearch&tabClickIndex=0&subtabIndex=0";3  const input = typeof params === "object" && params ? params : {};4  const limitValue = Number(input.limit);5  const limit = Math.max(1, Math.min(Number.isFinite(limitValue) ? Math.trunc(limitValue) : 20, 100));6 7  const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));8  const cleanText = (node) => (node?.textContent || "").replace(/\s+/g, " ").trim();9  const sameTarget = () => location.href.startsWith(targetUrl);10 11  if (!sameTarget()) {12    location.assign(targetUrl);13  }14 15  const startedAt = Date.now();16  while (Date.now() - startedAt < 15000) {17    const hasRows = document.querySelector("div.top-cell[data-code]");18    const blockedText = document.body?.innerText || "";19    if (hasRows || /验证|captcha|访问过于频繁|安全/.test(blockedText)) break;20    await sleep(250);21  }22 23  const cells = document.querySelectorAll("div.top-cell[data-code]");24  const results = [];25  const seen = new Set();26 27  cells.forEach((cell, index) => {28    const symbol = cell.getAttribute("data-code") || "";29    const name = cell.getAttribute("data-name") || "";30    if (!symbol || !name || seen.has(symbol)) return;31    seen.add(symbol);32 33    const tags = Array.from(cell.querySelectorAll("div.tips-item.gnbk"))34      .map((item) => cleanText(item))35      .filter(Boolean);36 37    results.push({38      rank: index + 1,39      symbol,40      name,41      changePercent: cleanText(cell.querySelector("div.top-zf")),42      heat: cleanText(cell.querySelector("div.hotN")),43      tags,44      url: location.href,45    });46  });47 48  return {49    sourceUrl: targetUrl,50    count: Math.min(results.length, limit),51    items: results.slice(0, limit),52  };53})();