Skip to content

Commit b60bb21

Browse files
authored
feat: Add new source: 腾讯新闻-综合早报 (#255)
1 parent 3e870e1 commit b60bb21

6 files changed

Lines changed: 99 additions & 1 deletion

File tree

public/icons/tencent.png

3.37 KB
Loading

server/glob.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ declare module 'glob:./sources/{*.ts,**/index.ts}' {
3232
export const sputniknewscn: typeof import('./sources/sputniknewscn')
3333
export const sspai: typeof import('./sources/sspai')
3434
export const steam: typeof import('./sources/steam')
35+
export const tencent: typeof import('./sources/tencent')
3536
export const thepaper: typeof import('./sources/thepaper')
3637
export const tieba: typeof import('./sources/tieba')
3738
export const toutiao: typeof import('./sources/toutiao')

server/sources/tencent.ts

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
import { myFetch } from "#/utils/fetch"
2+
import { defineSource } from "#/utils/source"
3+
4+
interface WapRes {
5+
ret: number
6+
msg: string
7+
data: {
8+
id: number
9+
name: string
10+
lead: string
11+
cover?: string
12+
shareTitle: string
13+
shareAbstract: string
14+
sharePic: string
15+
is724: boolean
16+
is724Paper: boolean
17+
head_cmsid: string
18+
feed_style: number
19+
head_article: {
20+
live_info: string
21+
title: string
22+
img: string
23+
pub_time: string
24+
media_name: string
25+
}
26+
paperInfo: any
27+
tabs: {
28+
id: string
29+
channel_id: string
30+
name: string
31+
source: string
32+
type: string
33+
articleList: any[]
34+
article_count: number
35+
sub_tab: string
36+
}[]
37+
banner: string
38+
}
39+
}
40+
41+
/**
42+
* 综合早报
43+
*/
44+
const comprehensiveNews = defineSource(async () => {
45+
const url = "https://i.news.qq.com/web_backend/v2/getTagInfo?tagId=aEWqxLtdgmQ%3D"
46+
const res = await myFetch<WapRes>(url, {
47+
headers: {
48+
Referer: "https://news.qq.com/",
49+
},
50+
})
51+
return res.data.tabs[0].articleList.map(news => ({
52+
id: news.id,
53+
title: news.title,
54+
url: news.link_info.url,
55+
extra: {
56+
hover: news.desc,
57+
},
58+
}))
59+
})
60+
61+
export default defineSource({
62+
"tencent-hot": comprehensiveNews,
63+
})

shared/pinyin.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,6 @@
4343
"chongbuluo-latest": "chongbuluo-zuixin",
4444
"chongbuluo-hot": "chongbuluo-zuire",
4545
"douban": "douban-remendianying",
46-
"steam": "Steam-zaixianrenshu"
46+
"steam": "Steam-zaixianrenshu",
47+
"tencent-hot": "tengxunxinwen-zonghezaobao"
4748
}

shared/pre-sources.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,20 @@ export const originSources = {
429429
type: "hottest",
430430
home: "https://store.steampowered.com",
431431
},
432+
"tencent": {
433+
name: "腾讯新闻",
434+
column: "china",
435+
color: "blue",
436+
home: "https://news.qq.com",
437+
sub: {
438+
hot: {
439+
title: "综合早报",
440+
type: "hottest",
441+
interval: Time.Common,
442+
home: "https://news.qq.com/tag/aEWqxLtdgmQ=",
443+
},
444+
},
445+
},
432446
} as const satisfies Record<string, OriginSource>
433447

434448
export function genSources() {

shared/sources.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -490,5 +490,24 @@
490490
"home": "https://store.steampowered.com",
491491
"color": "blue",
492492
"interval": 600000
493+
},
494+
"tencent": {
495+
"redirect": "tencent-hot",
496+
"name": "腾讯新闻",
497+
"type": "hottest",
498+
"column": "china",
499+
"home": "https://news.qq.com/tag/aEWqxLtdgmQ=",
500+
"color": "blue",
501+
"interval": 1800000,
502+
"title": "综合早报"
503+
},
504+
"tencent-hot": {
505+
"name": "腾讯新闻",
506+
"type": "hottest",
507+
"column": "china",
508+
"home": "https://news.qq.com/tag/aEWqxLtdgmQ=",
509+
"color": "blue",
510+
"interval": 1800000,
511+
"title": "综合早报"
493512
}
494513
}

0 commit comments

Comments
 (0)