feat: add source 什么值得买 (#117)

* feat: add source 什么值得买

* 恢复sources.json的缩进
This commit is contained in:
urlyy
2025-04-07 00:15:09 +08:00
committed by GitHub
parent 43ada762f6
commit 9efda2ab67
6 changed files with 55 additions and 17 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

+1
View File
@@ -21,6 +21,7 @@ declare module 'glob:./sources/{*.ts,**/index.ts}' {
export const nowcoder: typeof import('./sources/nowcoder')
export const pcbeta: typeof import('./sources/pcbeta')
export const producthunt: typeof import('./sources/producthunt')
export const smzdm: typeof import('./sources/smzdm')
export const solidot: typeof import('./sources/solidot')
export const sputniknewscn: typeof import('./sources/sputniknewscn')
export const thepaper: typeof import('./sources/thepaper')
+21
View File
@@ -0,0 +1,21 @@
import * as cheerio from "cheerio"
import type { NewsItem } from "@shared/types"
export default defineSource(async () => {
const baseURL = "https://post.smzdm.com/hot_1/"
const html: any = await myFetch(baseURL)
const $ = cheerio.load(html)
const $main = $("#feed-main-list .z-feed-title")
const news: NewsItem[] = []
$main.each((_, el) => {
const a = $(el).find("a")
const url = a.attr("href")!
const title = a.text()
news.push({
url,
title,
id: url,
})
})
return news
})
+3 -2
View File
@@ -33,8 +33,9 @@
"kaopu": "kaopuxinwen",
"jin10": "jinshishuju",
"baidu": "baiduresou",
"nowcoder": "niuke",
"linuxdo-latest": "LINUX DO-zuixin",
"linuxdo-hot": "LINUX DO-jinrizuire",
"ghxi": "guoheboke"
"ghxi": "guoheboke",
"smzdm": "shenmezhidemai",
"nowcoder": "niuke"
}
+14 -7
View File
@@ -304,13 +304,6 @@ export const originSources = {
type: "hottest",
home: "https://www.baidu.com",
},
"nowcoder": {
name: "牛客",
column: "china",
color: "blue",
type: "hottest",
home: "https://www.nowcoder.com",
},
"linuxdo": {
name: "LINUX DO",
column: "tech",
@@ -337,6 +330,20 @@ export const originSources = {
disable: "cf",
home: "https://www.ghxi.com/",
},
"smzdm": {
name: "什么值得买",
column: "china",
color: "red",
type: "hottest",
home: "https://www.smzdm.com",
},
"nowcoder": {
name: "牛客",
column: "china",
color: "blue",
type: "hottest",
home: "https://www.nowcoder.com",
},
} as const satisfies Record<string, OriginSource>
export function genSources() {
+16 -8
View File
@@ -378,14 +378,6 @@
"color": "blue",
"interval": 600000
},
"nowcoder": {
"name": "牛客",
"type": "hottest",
"column": "china",
"home": "https://www.nowcoder.com",
"color": "blue",
"interval": 600000
},
"linuxdo": {
"redirect": "linuxdo-latest",
"name": "LINUX DO",
@@ -422,5 +414,21 @@
"home": "https://www.ghxi.com/",
"color": "yellow",
"interval": 600000
},
"smzdm": {
"name": "什么值得买",
"type": "hottest",
"column": "china",
"home": "https://www.smzdm.com",
"color": "red",
"interval": 600000
},
"nowcoder": {
"name": "牛客",
"type": "hottest",
"column": "china",
"home": "https://www.nowcoder.com",
"color": "blue",
"interval": 600000
}
}