匹配范围
*://weread.qq.com/*weread-book-ranking用途 读取微信读书公开分类榜单,返回榜单排名、标题、作者、分类、阅读人数和 bookId。 执行前提 在 https://weread.qq.com/ 域名下的任意页面执行。脚本读取公开榜单接口,不要求登录;如果站点临时限制访问,可能返回 HTTP 错误或空结果。 参数 category:可选,榜单分类,默认 all。可传 all、rising 或微信读书…
*://weread.qq.com/*dom.read1return await (async () => {2 const input = params && typeof params === "object" ? params : {};3 const category = String(input.category || "all").trim() || "all";4 const limit = Math.max(1, Math.min(Number(input.limit || 20) || 20, 100));5 6 const url = new URL(`/web/bookListInCategory/${encodeURIComponent(category)}`, "https://weread.qq.com");7 url.searchParams.set("rank", "1");8 9 const response = await fetch(url.toString(), {10 credentials: "include",11 headers: {12 Accept: "application/json, text/plain, */*",13 },14 });15 16 if (!response.ok) {17 throw new Error(`榜单请求失败:HTTP ${response.status}`);18 }19 20 const data = await response.json();21 const books = Array.isArray(data?.books) ? data.books : [];22 const cleanText = (value) => String(value || "").replace(/\s+/g, " ").trim();23 24 return books.slice(0, limit).map((item, index) => ({25 rank: index + 1,26 title: cleanText(item?.bookInfo?.title),27 author: cleanText(item?.bookInfo?.author),28 category: cleanText(item?.bookInfo?.category),29 readingCount: Number(item?.readingCount || 0),30 bookId: cleanText(item?.bookInfo?.bookId),31 }));32})();