mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-06 05:03:44 +08:00
@@ -3230,6 +3230,10 @@ type 为 all 时,category 参数不支持 cost 和 free
|
|||||||
|
|
||||||
</route>
|
</route>
|
||||||
|
|
||||||
|
### 大众点评
|
||||||
|
|
||||||
|
<route name="用户" author="brilon" example="/dianping/user/35185271" path="/dianping/user/:id" :paramsDesc="['用户id,可在 URL 中找到']"/>
|
||||||
|
|
||||||
### 半月谈
|
### 半月谈
|
||||||
|
|
||||||
<route name="板块" author="LogicJake" example="/banyuetan/jicengzhili" path="/banyuetan/:name" :paramsDesc="['板块名称,可在 URL 中找到']"/>
|
<route name="板块" author="LogicJake" example="/banyuetan/jicengzhili" path="/banyuetan/:name" :paramsDesc="['板块名称,可在 URL 中找到']"/>
|
||||||
|
|||||||
@@ -1175,6 +1175,9 @@ router.get('/zjgsu/tzgg', require('./routes/universities/zjgsu/tzgg/scripts'));
|
|||||||
router.get('/zjgsu/gsgg', require('./routes/universities/zjgsu/gsgg/scripts'));
|
router.get('/zjgsu/gsgg', require('./routes/universities/zjgsu/gsgg/scripts'));
|
||||||
router.get('/zjgsu/xszq', require('./routes/universities/zjgsu/xszq/scripts'));
|
router.get('/zjgsu/xszq', require('./routes/universities/zjgsu/xszq/scripts'));
|
||||||
|
|
||||||
|
// 大众点评
|
||||||
|
router.get('/dianping/user/:id?', require('./routes/dianping/user'));
|
||||||
|
|
||||||
// 半月谈
|
// 半月谈
|
||||||
router.get('/banyuetan/:name', require('./routes/banyuetan'));
|
router.get('/banyuetan/:name', require('./routes/banyuetan'));
|
||||||
|
|
||||||
|
|||||||
96
lib/routes/dianping/user.js
Normal file
96
lib/routes/dianping/user.js
Normal file
@@ -0,0 +1,96 @@
|
|||||||
|
const axios = require('../../utils/axios');
|
||||||
|
const date = require('../../utils/date');
|
||||||
|
|
||||||
|
module.exports = async (ctx) => {
|
||||||
|
const id = ctx.params.id;
|
||||||
|
|
||||||
|
const userAgent = 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1';
|
||||||
|
const userPage = `https://m.dianping.com/userprofile/${id}`;
|
||||||
|
|
||||||
|
const pageResponse = await axios({
|
||||||
|
method: 'get',
|
||||||
|
url: userPage,
|
||||||
|
headers: {
|
||||||
|
'User-Agent': userAgent,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
const nickNameReg = /window\.nickName = "(.*?)"/g;
|
||||||
|
const nickName = nickNameReg.exec(pageResponse.data)[1];
|
||||||
|
|
||||||
|
const response = await axios({
|
||||||
|
method: 'get',
|
||||||
|
url: `https://m.dianping.com/member/ajax/NobleUserFeeds?userId=${id}`,
|
||||||
|
headers: {
|
||||||
|
'User-Agent': userAgent,
|
||||||
|
Referer: userPage,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const data = response.data.data;
|
||||||
|
const starMap = {
|
||||||
|
0: '无',
|
||||||
|
10: '一星',
|
||||||
|
20: '二星',
|
||||||
|
30: '三星',
|
||||||
|
35: '三星半',
|
||||||
|
40: '四星',
|
||||||
|
45: '四星半',
|
||||||
|
50: '五星',
|
||||||
|
};
|
||||||
|
const out = data.map(function(item) {
|
||||||
|
let link = '';
|
||||||
|
let title = '';
|
||||||
|
let content = '';
|
||||||
|
const pubDate = date(item.addTime);
|
||||||
|
const poi = item.poi ? `地点:<a href="http://www.dianping.com/shop/${item.poi.shopId}">${item.poi.name} - ${item.poi.regionCategory}</a>` : '';
|
||||||
|
const poiName = item.poi ? item.poi.name : '';
|
||||||
|
if (item.feedType === 1101) {
|
||||||
|
// 签到成功
|
||||||
|
link = `https://m.dianping.com/ugcdetail/${item.mainId}?sceneType=0&bizType=3`;
|
||||||
|
content = poi;
|
||||||
|
title = `签到成功: ${poiName} `;
|
||||||
|
} else if (item.feedType === 101) {
|
||||||
|
// 发布点评
|
||||||
|
link = `https://m.dianping.com/ugcdetail/${item.mainId}?sceneType=0&bizType=1`;
|
||||||
|
content = item.content.replace(/\n+/g, '<br>') + '<br>';
|
||||||
|
content += `评分:${starMap[item.star]}<br>`;
|
||||||
|
content += poi + '<br>';
|
||||||
|
content += item.pictureList
|
||||||
|
? item.pictureList
|
||||||
|
.map(function(ele) {
|
||||||
|
return `<img src="${ele.picUrl}" />`;
|
||||||
|
})
|
||||||
|
.join('<br>')
|
||||||
|
: '';
|
||||||
|
title = `发布点评: ${poiName}`;
|
||||||
|
} else if (item.feedType === 4208) {
|
||||||
|
// 发布攻略
|
||||||
|
link = `https://m.dianping.com/cityinsight/${item.mainId}`;
|
||||||
|
content = item.content.replace(/\n+/g, '<br>') + '<br>';
|
||||||
|
content += poi + '<br>';
|
||||||
|
content += item.pictureList
|
||||||
|
? item.pictureList
|
||||||
|
.map(function(ele) {
|
||||||
|
return `<img src="${ele.picUrl}" />`;
|
||||||
|
})
|
||||||
|
.join('<br>')
|
||||||
|
: '';
|
||||||
|
title = `发布攻略: ${poiName}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
const info = {
|
||||||
|
description: content,
|
||||||
|
title: title,
|
||||||
|
link: link,
|
||||||
|
pubDate: pubDate,
|
||||||
|
};
|
||||||
|
return info;
|
||||||
|
});
|
||||||
|
|
||||||
|
ctx.state.data = {
|
||||||
|
title: `大众点评 - ${nickName}`,
|
||||||
|
link: userPage,
|
||||||
|
description: `大众点评 - ${nickName}`,
|
||||||
|
item: out,
|
||||||
|
};
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user