RSSHub/lib/routes/meipai/utils.js

36 lines
1.1 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

const cheerio = require('cheerio');
const url = require('url');
const ProcessFeed = async (list) => {
const host = 'https://www.meipai.com';
return await Promise.all(
list.map(async (item) => {
const $ = cheerio.load(item);
const $title = $('.detail-cover-title');
const $desciption = $('.feed-description');
// 详情页面的地址(视频页面地址)
const itemUrl = url.resolve(host, $desciption.attr('href'));
// RSS内容美拍提供了友好的网页版视频展示
const imgSrc = $('.feed-v-wrap img').attr('src');
const text = $desciption.text() + `<a href="${itemUrl}"><img referrerpolicy="no-referrer" src="https:${imgSrc}" /></a>`;
// 列表上提取到的信息
return {
title: $title.text(),
description: text,
link: itemUrl,
author: $('.feed-name').text(),
guid: itemUrl,
};
})
);
};
module.exports = {
ProcessFeed,
};