mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-01 14:57:14 +08:00
feat(route): add Samsung Research Blog (#10081)
* feat(route): add Samsung Research Blog * fix: add hashTags to categories
This commit is contained in:
@@ -568,6 +568,12 @@ Compared to the official one, this feed:
|
||||
|
||||
<RouteEn author="nczitzk" example="/rss3/blog" path="/rss3/blog"/>
|
||||
|
||||
## Samsung
|
||||
|
||||
### Research Blog
|
||||
|
||||
<RouteEn author="nczitzk" example="/samsung/research/blog" path="/samsung/research/blog"/>
|
||||
|
||||
## Semiconductor Industry Association
|
||||
|
||||
### Latest News
|
||||
|
||||
@@ -1128,6 +1128,12 @@ IPFS 网关有可能失效,那时候换成其他网关。
|
||||
|
||||
<Route author="nczitzk" example="/rss3/blog" path="/rss3/blog"/>
|
||||
|
||||
## Samsung
|
||||
|
||||
### Research Blog
|
||||
|
||||
<Route author="nczitzk" example="/samsung/research/blog" path="/samsung/research/blog"/>
|
||||
|
||||
## Simons Foundation
|
||||
|
||||
### 文章
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
module.exports = {
|
||||
'/research/blog': ['nczitzk'],
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
module.exports = {
|
||||
'samsung.com': {
|
||||
_name: 'Samsung',
|
||||
research: [
|
||||
{
|
||||
title: 'Research Blog',
|
||||
docs: 'https://docs.rsshub.app/new-media.html#samsung-research-blog',
|
||||
source: ['/blog', '/'],
|
||||
target: '/samsung/research/blog',
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,49 @@
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const rootUrl = 'https://research.samsung.com';
|
||||
const currentUrl = `${rootUrl}/blogMain/list.json`;
|
||||
|
||||
const response = await got({
|
||||
method: 'post',
|
||||
url: currentUrl,
|
||||
json: {
|
||||
currentPageNo: 0,
|
||||
endIndex: 9,
|
||||
startIndex: 0,
|
||||
},
|
||||
});
|
||||
|
||||
let items = response.data.value.map((item) => ({
|
||||
title: item.title,
|
||||
author: item.authorName,
|
||||
link: `${rootUrl}${item.urlLink}`,
|
||||
category: [item.catagoryCode, item.hashTag1, item.hashTag2],
|
||||
pubDate: parseDate(item.publicationDtsStr.replace(/On /, ''), 'MMMM D, YYYY'),
|
||||
}));
|
||||
|
||||
items = await Promise.all(
|
||||
items.map((item) =>
|
||||
ctx.cache.tryGet(item.link, async () => {
|
||||
const detailResponse = await got({
|
||||
method: 'get',
|
||||
url: item.link,
|
||||
});
|
||||
|
||||
const content = cheerio.load(detailResponse.data);
|
||||
|
||||
item.description = content('.news-con').html();
|
||||
|
||||
return item;
|
||||
})
|
||||
)
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
title: 'BLOG | Samsung Research',
|
||||
link: `${rootUrl}/blog`,
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,3 @@
|
||||
module.exports = function (router) {
|
||||
router.get('/research/blog', require('./research/blog'));
|
||||
};
|
||||
Reference in New Issue
Block a user