MCPcopy
hub / github.com/Narcooo/inkos / FanqieRadarSource

Class FanqieRadarSource

packages/core/src/agents/radar-source.ts:53–86  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

51] as const;
52
53export class FanqieRadarSource implements RadarSource {
54 readonly name = "fanqie";
55
56 async fetch(): Promise<PlatformRankings> {
57 const entries: RankingEntry[] = [];
58
59 for (const { sideType, label } of FANQIE_RANK_TYPES) {
60 try {
61 const url = `https://api-lf.fanqiesdk.com/api/novel/channel/homepage/rank/rank_list/v2/?aid=13&limit=15&offset=0&side_type=${sideType}`;
62 const res = await globalThis.fetch(url, {
63 headers: { "User-Agent": "Mozilla/5.0 (compatible; InkOS/0.1)" },
64 });
65 if (!res.ok) continue;
66 const data = (await res.json()) as Record<string, unknown>;
67 const list = (data as { data?: { result?: unknown[] } }).data?.result;
68 if (!Array.isArray(list)) continue;
69
70 for (const item of list) {
71 const rec = item as Record<string, unknown>;
72 entries.push({
73 title: String(rec.book_name ?? ""),
74 author: String(rec.author ?? ""),
75 category: String(rec.category ?? ""),
76 extra: `[${label}]`,
77 });
78 }
79 } catch {
80 // skip on network error
81 }
82 }
83
84 return { platform: "番茄小说", entries };
85 }
86}
87
88export class QidianRadarSource implements RadarSource {
89 readonly name = "qidian";

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected