mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-24 23:12:34 +08:00
feat: add 贾真的电商108将 (#6158)
This commit is contained in:
@@ -1673,3 +1673,9 @@ QueryString:
|
||||
### 全文
|
||||
|
||||
<Route author="HenryQW" example="/zzz" path="/zzz/index"/>
|
||||
|
||||
## 贾真的电商 108 将
|
||||
|
||||
### 「108 将」实战分享
|
||||
|
||||
<Route author="nczitzk" example="/jiazhen108" path="/jiazhen108" />
|
||||
|
||||
@@ -3494,6 +3494,9 @@ router.get('/mitbbs/:caty?', require('./routes/mitbbs/index'));
|
||||
router.get('/8kcos/', require('./routes/8kcos/latest'));
|
||||
router.get('/8kcos/cat/:cat*', require('./routes/8kcos/cat'));
|
||||
|
||||
// 贾真的电商108将
|
||||
router.get('/jiazhen108', require('./routes/jiazhen108/index'));
|
||||
|
||||
// Instagram
|
||||
router.get('/instagram/:category/:key', require('./routes/instagram/index'));
|
||||
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const rootUrl = 'http://www.jiazhen108.com/news/';
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: rootUrl,
|
||||
});
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
|
||||
const list = $('div.met-news-list ul li')
|
||||
.slice(0, 10)
|
||||
.map((_, item) => {
|
||||
item = $(item);
|
||||
const a = item.find('a');
|
||||
return {
|
||||
title: a.text(),
|
||||
link: a.attr('href'),
|
||||
};
|
||||
})
|
||||
.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('section.met-editor').html();
|
||||
item.pubDate = new Date(content('div.info span').eq(0).text() + ' GMT+8').toUTCString();
|
||||
|
||||
return item;
|
||||
})
|
||||
)
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
title: `「108将」实战分享`,
|
||||
link: rootUrl,
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user