mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-24 23:12:34 +08:00
修复煎蛋的图片解析 (#1917)
This commit is contained in:
@@ -1,10 +1,6 @@
|
||||
const axios = require('../../utils/axios');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
const base64_decode = (i) => Buffer.from(i, 'base64').toString('binary');
|
||||
|
||||
// jandan_decode is borrowed from jandan.net, which is used in function jandan_load_img.
|
||||
const jandan_decode = (m) => base64_decode(m);
|
||||
const baseUrl = 'http://jandan.net/';
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
@@ -35,21 +31,18 @@ module.exports = async (ctx) => {
|
||||
|
||||
const imgList = [];
|
||||
$(item)
|
||||
.find('.text .img-hash')
|
||||
.find('.view_img_link')
|
||||
.each((_, item) => {
|
||||
const imgUrl = $(item).html();
|
||||
const imgUrl = $(item).attr('href');
|
||||
|
||||
if (imgUrl !== undefined) {
|
||||
imgList.push(jandan_decode(imgUrl).replace(/(\/\/\w+\.sinaimg\.cn\/)(\w+)(\/.+\.(gif|jpg|jpeg))/, '$1large$3'));
|
||||
imgList.push(imgUrl);
|
||||
}
|
||||
});
|
||||
if (imgList.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
$(item)
|
||||
.find('.img-hash')
|
||||
.remove();
|
||||
const text =
|
||||
$(item)
|
||||
.find('.text p')
|
||||
|
||||
Reference in New Issue
Block a user