mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-10-18 14:29:01 +08:00
8d5836e3f3
* fix(route): 9to5/subsite fix selector and refactor to V2 * Update lib/v2/9to5/radar.js Co-authored-by: Rongrong <i@rong.moe> * Update lib/v2/9to5/radar.js Co-authored-by: Rongrong <i@rong.moe> * Update lib/v2/9to5/radar.js Co-authored-by: Rongrong <i@rong.moe> * fix(route): change link * Update lib/v2/9to5/subsite.js Co-authored-by: Rongrong <i@rong.moe> * Update lib/v2/9to5/radar.js Co-authored-by: Rongrong <i@rong.moe> * Update lib/v2/9to5/radar.js Co-authored-by: Rongrong <i@rong.moe> * Update lib/v2/9to5/radar.js Co-authored-by: Rongrong <i@rong.moe> * fix(docs): add radar and rssbud badges * Update lib/v2/9to5/subsite.js Co-authored-by: Tony <TonyRL@users.noreply.github.com> Co-authored-by: Rongrong <i@rong.moe> Co-authored-by: Tony <TonyRL@users.noreply.github.com>
37 lines
876 B
JavaScript
37 lines
876 B
JavaScript
const cheerio = require('cheerio');
|
|
|
|
const ProcessFeed = (data) => {
|
|
const $ = cheerio.load(data);
|
|
const content = $('div.post-body');
|
|
|
|
const cover = $('meta[property="og:image"]');
|
|
if (cover.length > 0) {
|
|
$(`<img src=${cover[0].attribs.content}>`).insertBefore(content[0].firstChild);
|
|
}
|
|
|
|
// remove useless DOMs
|
|
content.find('hr').nextAll().remove();
|
|
|
|
content.find('hr, ins.adsbygoogle, script').each((i, e) => {
|
|
$(e).remove();
|
|
});
|
|
|
|
// remove ad
|
|
content.find('div.ad-disclaimer-container').remove();
|
|
|
|
content.find('div').each((i, e) => {
|
|
if ($(e)[0].attribs.class) {
|
|
const classes = $(e)[0].attribs.class;
|
|
if (classes.match(/\w{10}\s\w{10}/g)) {
|
|
$(e).remove();
|
|
}
|
|
}
|
|
});
|
|
|
|
return content.html();
|
|
};
|
|
|
|
module.exports = {
|
|
ProcessFeed,
|
|
};
|