mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-24 23:12:34 +08:00
@@ -120,6 +120,12 @@ Language
|
||||
|
||||
<RouteEn author="ttttmr" example="/clash/premium" path="/clash/premium" radar="1" />
|
||||
|
||||
## CPUID
|
||||
|
||||
### News
|
||||
|
||||
<RouteEn author="TonyRL" example="/cpuid/news" path="/cpuid/news" radar="1" rssbud="1"/>
|
||||
|
||||
## CurseForge
|
||||
|
||||
### File Update
|
||||
|
||||
@@ -146,6 +146,12 @@ pageClass: routes
|
||||
|
||||
<Route author="ttttmr" example="/clash/premium" path="/clash/premium" radar="1" />
|
||||
|
||||
## CPUID
|
||||
|
||||
### 新闻
|
||||
|
||||
<Route author="TonyRL" example="/cpuid/news" path="/cpuid/news" radar="1" rssbud="1"/>
|
||||
|
||||
## cpython
|
||||
|
||||
### 正式版本发布
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
const newsUrl = 'https://www.cpuid.com/news.html';
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const response = await got(newsUrl);
|
||||
const $ = cheerio.load(response.data);
|
||||
|
||||
const items = $('.block_100 .js-block-news')
|
||||
.toArray()
|
||||
.map((item) => {
|
||||
item = $(item);
|
||||
return {
|
||||
title: item.find('.information a').text(),
|
||||
description: item.find('.description').html(),
|
||||
link: item.find('.information a').attr('href'),
|
||||
pubDate: parseDate(item.find('time[itemprop=dateCreated]').attr('datetime')),
|
||||
};
|
||||
});
|
||||
|
||||
ctx.state.data = {
|
||||
title: $('head title').text(),
|
||||
description: $('head description').attr('content'),
|
||||
link: newsUrl,
|
||||
image: $('link[rel=apple-touch-icon-precomposed]').attr('href'),
|
||||
item: items,
|
||||
language: $('html').attr('lang'),
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
module.exports = {
|
||||
'cpuid.com': {
|
||||
_name: 'CPUID',
|
||||
'.': [
|
||||
{
|
||||
title: 'News',
|
||||
docs: 'https://docs.rsshub.app/program-update.html#cpuid',
|
||||
source: ['/news.html', '/'],
|
||||
target: '/cpuid/news',
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,3 @@
|
||||
module.exports = (router) => {
|
||||
router.get('/news', require('./news'));
|
||||
};
|
||||
Reference in New Issue
Block a user