fix: 色花堂 (#6733)
https://github.com/DIYgod/RSSHub/issues/6702 Co-authored-by: junfeng <junfeng_pan96@qq.com>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const url = require('url');
|
||||
|
||||
const host = 'https://www.sehuatang.net/';
|
||||
|
||||
@@ -90,7 +91,10 @@ module.exports = async (ctx) => {
|
||||
}
|
||||
}
|
||||
const description = (postMessage.html() || '抓取原帖失败').replace(/ignore_js_op/g, 'div');
|
||||
const enclosureUrl = postMessage.find('div.blockcode li').text();
|
||||
|
||||
const magnet = postMessage.find('div.blockcode li').text();
|
||||
const isMag = magnet.startsWith('magnet');
|
||||
const enclosureUrl = isMag ? magnet : url.resolve(host, postMessage.find('a[href^=forum\\.php\\?mod\\=attachment]:not([href$=nothumb\\=yes])').attr('href'));
|
||||
|
||||
const single = {
|
||||
title: title,
|
||||
@@ -98,7 +102,7 @@ module.exports = async (ctx) => {
|
||||
description: description,
|
||||
pubDate: new Date(date).toUTCString(),
|
||||
enclosure_url: enclosureUrl,
|
||||
enclosure_type: 'application/x-bittorrent',
|
||||
enclosure_type: isMag ? 'application/x-bittorrent' : 'application/octet-stream',
|
||||
};
|
||||
if (description !== '抓取原帖失败') {
|
||||
ctx.cache.set(itemUrl, JSON.stringify(single));
|
||||
|
||||
Reference in New Issue
Block a user