mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-10-24 12:15:32 +08:00
修复多闻图集新闻 (#953)
This commit is contained in:
@@ -38,11 +38,10 @@ module.exports = async (ctx) => {
|
||||
if (cache) {
|
||||
return Promise.resolve(JSON.parse(cache));
|
||||
}
|
||||
item.url = 'http://news.dwnews.com/global/news/2018-10-08/60089463.html';
|
||||
const response = await axios.get(item.url.replace('.html', '_all.html'));
|
||||
const $ = cheerio.load(response.data);
|
||||
|
||||
const result = utils.ProcessRank($, item);
|
||||
const result = utils.ProcessRank($, ctx.params.type);
|
||||
|
||||
const single = {
|
||||
title: item.title,
|
||||
|
||||
+32
-9
@@ -1,3 +1,5 @@
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
const ProcessFeed = ($, item) => {
|
||||
let content;
|
||||
if (item.filetype === 'TJ') {
|
||||
@@ -19,25 +21,46 @@ const ProcessFeed = ($, item) => {
|
||||
return content.html();
|
||||
};
|
||||
|
||||
const ProcessRank = ($) => {
|
||||
const ProcessRank = ($, type) => {
|
||||
let content, author;
|
||||
|
||||
const pubDate = new Date($('div.time').text());
|
||||
pubDate.setHours(pubDate.getHours() - 8);
|
||||
|
||||
content = $('div.dia-lead-one');
|
||||
if (type === 'news') {
|
||||
if (content.length === 0) {
|
||||
content = $('div.container');
|
||||
|
||||
if (content.length === 0) {
|
||||
content = $('div.container');
|
||||
author = $('div.author').text();
|
||||
} else {
|
||||
author = $('div.nw').text();
|
||||
}
|
||||
|
||||
author = $('div.author').text();
|
||||
ProcessQuote($, content);
|
||||
ProcessImage($, content);
|
||||
Clean($, content);
|
||||
} else {
|
||||
author = $('div.nw').text();
|
||||
}
|
||||
let images = $('div#slider_component_4_0 > img');
|
||||
if ($('div#slider_component_4_0 > img').length > 0) {
|
||||
$('div.captions > p').each((i, e) => {
|
||||
$(images[i]).insertBefore(e);
|
||||
});
|
||||
content = $('div.captions');
|
||||
} else {
|
||||
images = $('div#component_4_0 .sd-page > img');
|
||||
|
||||
ProcessQuote($, content);
|
||||
ProcessImage($, content);
|
||||
Clean($, content);
|
||||
content = cheerio.load('<div></div>');
|
||||
content = content('div');
|
||||
|
||||
$('.sqbtnbox > .tzbox')
|
||||
.slice(1)
|
||||
.each((i, e) => {
|
||||
$(images[i]).appendTo(content);
|
||||
$(e).appendTo(content);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
description: content.html(),
|
||||
|
||||
Reference in New Issue
Block a user