mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-24 23:12:34 +08:00
feat: add 泉州市跨境电子商务协会 (#5691)
Co-authored-by: Henry Wang <hi@henry.wang>
This commit is contained in:
@@ -71,6 +71,18 @@ pageClass: routes
|
||||
|
||||
<Route author="HenryQW" example="/un/scveto" path="/un/scveto"/>
|
||||
|
||||
## 泉州市跨境电子商务协会
|
||||
|
||||
### 新闻动态
|
||||
|
||||
<Route author="nczitzk" example="/qzcea" path="/qzcea/:caty?" :paramsDesc="['分类 id,默认为 1']">
|
||||
|
||||
| 新闻动态 | 协会动态 | 通知公告 | 会员风采 | 政策法规 | 电商资讯 |
|
||||
| -------- | -------- | -------- | -------- | -------- | -------- |
|
||||
| 1 | 2 | 3 | 5 | 14 | 18 |
|
||||
|
||||
</Route>
|
||||
|
||||
## 日本国外務省
|
||||
|
||||
### 記者会見
|
||||
|
||||
@@ -3216,6 +3216,9 @@ router.get('/feixuew/:id?', require('./routes/feixuew/index'));
|
||||
// 1X
|
||||
router.get('/1x/:type?/:caty?', require('./routes/1x/index'));
|
||||
|
||||
// 泉州市跨境电子商务协会
|
||||
router.get('/qzcea/:caty?', require('./routes/qzcea/index'));
|
||||
|
||||
// 福利年
|
||||
router.get('/fulinian/:caty?', require('./routes/fulinian/index'));
|
||||
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
ctx.params.caty = ctx.params.caty || '1';
|
||||
|
||||
const rootUrl = 'http://www.qzcea.org';
|
||||
const currentUrl = `${rootUrl}/usernewscatname_nc${ctx.params.caty}`;
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: currentUrl,
|
||||
});
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
|
||||
$('a.news-more').remove();
|
||||
|
||||
const list = $('li.clearfix div.news-right a')
|
||||
.slice(0, 10)
|
||||
.map((_, item) => {
|
||||
item = $(item);
|
||||
return {
|
||||
title: item.text(),
|
||||
link: `${rootUrl}${item.attr('href')}`,
|
||||
pubDate: new Date(item.next().text().replace('时间 :', '') + ' GMT+8').toUTCString(),
|
||||
};
|
||||
})
|
||||
.get();
|
||||
|
||||
const items = await Promise.all(
|
||||
list.map(
|
||||
async (item) =>
|
||||
await ctx.cache.tryGet(item.link, async () => {
|
||||
const detailResponse = await got({
|
||||
method: 'get',
|
||||
url: item.link,
|
||||
});
|
||||
const content = cheerio.load(detailResponse.data);
|
||||
|
||||
item.description = content('div.newm').html();
|
||||
|
||||
return item;
|
||||
})
|
||||
)
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
title: `${$('title').text()} - 泉州市跨境电子商务协会`,
|
||||
link: currentUrl,
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user