feat(route): add fxiaoke.com blog (#14046)
* feat(route): add fxiaoke.com blog * Update lib/v2/fxiaoke/radar.js * Update lib/v2/fxiaoke/radar.js * Update lib/v2/fxiaoke/radar.js * Update lib/v2/fxiaoke/radar.js * Update lib/v2/fxiaoke/radar.js * Update lib/v2/fxiaoke/radar.js * Update lib/v2/fxiaoke/crm.js * gen exact pubdate ---------
This commit is contained in:
parent
c7518e4619
commit
fac29ed93b
|
|
@ -0,0 +1,63 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
const baseUrl = 'https://www.fxiaoke.com/crm';
|
||||
const baseTitle = '纷享销客 CRM';
|
||||
const titleMap = new Map([
|
||||
['news', `全部文章 - ${baseTitle}`],
|
||||
['blog', `文章干货 - ${baseTitle}`],
|
||||
['articles', `CRM 知识 - ${baseTitle}`],
|
||||
['about-influence', `纷享动态 - ${baseTitle}`],
|
||||
['customers', `签约喜报 - ${baseTitle}`],
|
||||
]);
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const t = ctx.params.type;
|
||||
const title = titleMap.get(t);
|
||||
const url = `${baseUrl}/${t}/`;
|
||||
const resp = await got(url);
|
||||
const $ = cheerio.load(resp.data);
|
||||
const desc = $('.meeting').text().trim();
|
||||
let items = $('.content-item')
|
||||
.toArray()
|
||||
.map((item) => {
|
||||
item = $(item);
|
||||
const c1 = item.find('.baike-content-t1');
|
||||
const c3 = item.find('.baike-content-t3').find('span');
|
||||
return {
|
||||
title: c1.text().trim(),
|
||||
// pubDate: parseDate(c3.first().text().trim()),
|
||||
link: item.find('a').attr('href'),
|
||||
author: c3.last().text().trim(),
|
||||
};
|
||||
});
|
||||
items = await Promise.all(
|
||||
items.map((item) =>
|
||||
ctx.cache.tryGet(item.link, async () => {
|
||||
const resp = await got(item.link);
|
||||
const $ = cheerio.load(resp.data);
|
||||
const firstViewBox = $('.body-wrapper-article').first();
|
||||
|
||||
firstViewBox.find('img').each((_, img) => {
|
||||
img = $(img);
|
||||
if (img.attr('zoomfile')) {
|
||||
img.attr('src', img.attr('zoomfile'));
|
||||
img.removeAttr('zoomfile');
|
||||
img.removeAttr('file');
|
||||
}
|
||||
img.removeAttr('onmouseover');
|
||||
});
|
||||
|
||||
item.description = firstViewBox.html();
|
||||
item.pubDate = parseDate($('.month-day').first().text().trim());
|
||||
return item;
|
||||
})
|
||||
)
|
||||
);
|
||||
ctx.state.data = {
|
||||
title,
|
||||
link: url,
|
||||
description: desc,
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
module.exports = {
|
||||
'/crm/:type': ['akynazh'],
|
||||
};
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
module.exports = {
|
||||
'fxiaoke.com': {
|
||||
_name: '纷享销客 CRM',
|
||||
'.': [
|
||||
{
|
||||
title: '全部文章',
|
||||
docs: 'https://docs.rsshub.app/routes/blog#fen-xiang-xiao-ke-crm',
|
||||
source: ['/*'],
|
||||
target: '/fxiaoke/crm/news',
|
||||
},
|
||||
{
|
||||
title: '文章干货',
|
||||
docs: 'https://docs.rsshub.app/routes/blog#fen-xiang-xiao-ke-crm',
|
||||
source: ['/*'],
|
||||
target: '/fxiaoke/crm/blog',
|
||||
},
|
||||
{
|
||||
title: 'CRM 知识',
|
||||
docs: 'https://docs.rsshub.app/routes/blog#fen-xiang-xiao-ke-crm',
|
||||
source: ['/*'],
|
||||
target: '/fxiaoke/crm/articles',
|
||||
},
|
||||
{
|
||||
title: '纷享动态',
|
||||
docs: 'https://docs.rsshub.app/routes/blog#fen-xiang-xiao-ke-crm',
|
||||
source: ['/*'],
|
||||
target: '/fxiaoke/crm/about-influence',
|
||||
},
|
||||
{
|
||||
title: '签约喜报',
|
||||
docs: 'https://docs.rsshub.app/routes/blog#fen-xiang-xiao-ke-crm',
|
||||
source: ['/*'],
|
||||
target: '/fxiaoke/crm/customers',
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
module.exports = function (router) {
|
||||
router.get('/crm/:type', require('./crm'));
|
||||
};
|
||||
|
|
@ -375,6 +375,16 @@ Limit the number of entries to be retrieved by adding `?limit=x` to the end of t
|
|||
| windows | android | tutorial | other |
|
||||
</Route>
|
||||
|
||||
## 纷享销客 CRM {#fen-xiang-xiao-ke-crm}
|
||||
|
||||
### 文章 {#fen-xiang-xiao-ke-crm-wen-zhang}
|
||||
|
||||
<Route author="akynazh" example="/fxiaoke/crm/news" path="/fxiaoke/crm/:type" paramsDesc={['文章类型, 见下表']}>
|
||||
| 全部文章 | 文章干货 | CRM 知识 | 纷享动态 | 签约喜报 |
|
||||
| -------- | -------- | -------- | --------------- | --------- |
|
||||
| news | blog | articles | about-influence | customers |
|
||||
</Route>
|
||||
|
||||
## 虎皮椒 {#hu-pi-jiao}
|
||||
|
||||
### 文章 {#hu-pi-jiao-wen-zhang}
|
||||
|
|
|
|||
Loading…
Reference in New Issue