Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added public/icons/gamerpower.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions server/glob.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ declare module 'glob:./sources/{*.ts,**/index.ts}' {
export const douyin: typeof import('./sources/douyin')
export const fastbull: typeof import('./sources/fastbull')
export const freebuf: typeof import('./sources/freebuf')
export const gamerpower: typeof import('./sources/gamerpower')
export const gelonghui: typeof import('./sources/gelonghui')
export const ghxi: typeof import('./sources/ghxi')
export const github: typeof import('./sources/github')
Expand Down
33 changes: 33 additions & 0 deletions server/sources/gamerpower.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// 定义 GamerPower 返回的数据结构
interface GamerPowerItem {
id: number
title: string
worth: string // 原价,例如 "$29.99"
thumbnail: string // 缩略图 URL
description: string
open_giveaway_url: string // 领取链接
published_date: string
platforms: string // 平台,例如 "PC, Steam"
end_date: string // 截止日期
}

export default defineSource(async () => {
// 调用 GamerPower 的公开 API
// 参数 platform=pc 表示只看电脑游戏,type=game 表示只看完整游戏
const url = "https://www.gamerpower.com/api/giveaways?platform=pc&type=game&sort-by=popularity"

const response = await fetch(url)
const data: GamerPowerItem[] = await response.json()

// 转换为 newsnow 需要的格式
return data.map(item => ({
id: item.id.toString(),
title: `[${item.platforms}] ${item.title} (原价 ${item.worth})`,
url: item.open_giveaway_url,
mobileUrl: item.open_giveaway_url,
pubDate: item.published_date,
extra: {
info: item.end_date !== "N/A" ? `截止: ${item.end_date}` : "长期有效",
},
}))
})
3 changes: 2 additions & 1 deletion shared/pinyin.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
"steam": "Steam-zaixianrenshu",
"tencent-hot": "tengxunxinwen-zonghezaobao",
"freebuf": "Freebuf-wangluoanquan",
"qqvideo-tv-hotsearch": "tengxunshipin-dianshiju-resoubang",
"gamerpower": "GamerPower (xijiayi)",
"qqvideo-tv-hotsearch": "tengxunshipin-resoubang",
"iqiyi-hot-ranklist": "aiqiyi-rebobang"
}
7 changes: 6 additions & 1 deletion shared/pre-sources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,12 @@ export const originSources = {
type: "hottest",
home: "https://www.freebuf.com/",
},

"gamerpower": {
name: "GamerPower (喜加一)",
column: "world",
color: "green",
home: "https://www.gamerpower.com",
},
"qqvideo": {
name: "腾讯视频",
column: "china",
Expand Down
11 changes: 9 additions & 2 deletions shared/sources.json
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,13 @@
"color": "green",
"interval": 600000
},
"gamerpower": {
"name": "GamerPower (喜加一)",
"column": "world",
"home": "https://www.gamerpower.com",
"color": "green",
"interval": 600000
},
"qqvideo": {
"redirect": "qqvideo-tv-hotsearch",
"name": "腾讯视频",
Expand All @@ -534,7 +541,7 @@
"home": "https://v.qq.com/channel/tv",
"color": "blue",
"interval": 1800000,
"title": "电视剧-热搜榜"
"title": "热搜榜"
},
"qqvideo-tv-hotsearch": {
"name": "腾讯视频",
Expand All @@ -543,7 +550,7 @@
"home": "https://v.qq.com/channel/tv",
"color": "blue",
"interval": 1800000,
"title": "电视剧-热搜榜"
"title": "热搜榜"
},
"iqiyi": {
"redirect": "iqiyi-hot-ranklist",
Expand Down