diff --git a/docs/README.md b/docs/README.md
index a3c9da080..0f594f093 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -767,7 +767,11 @@ GitHub 官方也提供了一些 RSS:
-
+
+
+| 妹子图 | 热榜 |
+| ------ | -------- |
+| ooxx | top-ooxx |
### 喷嚏
diff --git a/routes/jandan/pic.js b/routes/jandan/pic.js
index e953bc882..4c894e9c4 100644
--- a/routes/jandan/pic.js
+++ b/routes/jandan/pic.js
@@ -20,7 +20,7 @@ module.exports = async (ctx) => {
const $ = cheerio.load(response.data);
- const items = Array();
+ const items = [];
$('.commentlist > li').each((_, item) => {
// Get current comment id, if comment_id is 'adsense', just need to skip..
const comment_id = $(item).attr('id');
@@ -29,32 +29,43 @@ module.exports = async (ctx) => {
}
// Get current comment's link.
- const link = $(item)
+ let link = $(item)
.find('.righttext')
.find('a')
.attr('href');
- if (link === undefined) {
- return;
+
+ if (link !== undefined) {
+ link = `http:${link}`;
+ } else {
+ // sub_model 为 top-ooxx 时无链接
+ link = '';
}
- // Get current comment's images.
- // TODO: should support multiple images.
- let img_url = $(item)
- .find('.text')
- .find('.img-hash')
- .html();
- if (img_url === null) {
+ const imgList = [];
+
+ $(item)
+ .find('.text .img-hash')
+ .each((_, item) => {
+ const imgUrl = $(item).html();
+
+ if (imgUrl !== undefined) {
+ imgList.push(jandan_decode(imgUrl).replace(/(\/\/\w+\.sinaimg\.cn\/)(\w+)(\/.+\.(gif|jpg|jpeg))/, '$1large$3'));
+ }
+ });
+ if (imgList.length === 0) {
return;
}
- img_url = jandan_decode(img_url);
- img_url = img_url.replace(/(\/\/\w+\.sinaimg\.cn\/)(\w+)(\/.+\.(gif|jpg|jpeg))/, '$1large$3');
// TODO: should load user's comments.
items.push({
+ guid: comment_id,
title: comment_id,
- description: `
`,
- link: `http:${link}`,
+ description: imgList.reduce((description, imgUrl) => {
+ description += `
`;
+ return description;
+ }, ''),
+ link,
});
});
@@ -66,6 +77,9 @@ module.exports = async (ctx) => {
} else if (sub_model === 'ooxx') {
rss_title = '煎蛋妹子图';
description = '这儿才是正版妹子图。';
+ } else if (sub_model === 'top-ooxx') {
+ rss_title = '煎蛋妹子图热榜';
+ description = ''; // TODO: 这里写啥好
}
ctx.state.data = {