this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

tweaks

EGOIST d0424d29 15f7f275

+29 -31
+2 -4
README.md
··· 1 - # anime 1 + # anime-sedai 2 2 3 3 To install dependencies: 4 4 ··· 9 9 To run: 10 10 11 11 ```bash 12 - bun run 12 + bun dev 13 13 ``` 14 - 15 - This project was created using `bun init` in bun v1.2.8. [Bun](https://bun.sh) is a fast all-in-one JavaScript runtime.
+27
init-data.ts
··· 1 + import { load } from "cheerio" 2 + import fs from "fs" 3 + 4 + // 2004 to 2024 5 + const years = Array.from({ length: 2024 - 2004 + 1 }, (_, i) => 2004 + i) 6 + 7 + type Item = { 8 + title: string 9 + score: number 10 + } 11 + const result: Record<string, Item[]> = {} 12 + for (const year of years) { 13 + console.log(`正在获取 ${year} 年的数据`) 14 + const url = `https://bgm.tv/anime/browser/tv/airtime/${year}?sort=trends` 15 + const response = await fetch(url) 16 + const html = await response.text() 17 + const $ = load(html) 18 + const items: Item[] = [] 19 + $(".item").each((_, el) => { 20 + const title = $(el).find("h3 .l").text().trim() 21 + const score = Number($(el).find(".rateInfo .fade").text().trim()) 22 + items.push({ title, score }) 23 + }) 24 + result[year] = items 25 + } 26 + 27 + fs.writeFileSync("anime.json", JSON.stringify(result, null, 2))
-27
run.ts
··· 1 - import { load } from "cheerio"; 2 - import fs from "fs"; 3 - 4 - // 2004 to 2024 5 - const years = Array.from({ length: 2024 - 2004 + 1 }, (_, i) => 2004 + i); 6 - 7 - type Item = { 8 - title: string; 9 - score: number; 10 - }; 11 - const result: Record<string, Item[]> = {}; 12 - for (const year of years) { 13 - console.log(`正在获取 ${year} 年的数据`); 14 - const url = `https://bgm.tv/anime/browser/tv/airtime/${year}?sort=trends`; 15 - const response = await fetch(url); 16 - const html = await response.text(); 17 - const $ = load(html); 18 - const items: Item[] = []; 19 - $(".item").each((_, el) => { 20 - const title = $(el).find("h3 .l").text().trim(); 21 - const score = Number($(el).find(".rateInfo .fade").text().trim()); 22 - items.push({ title, score }); 23 - }); 24 - result[year] = items; 25 - } 26 - 27 - fs.writeFileSync("anime.json", JSON.stringify(result, null, 2));