Files
RSSHub/lib/routes/dysfz/index.js
T
Bright-W bacc388187 Update index.js (#1348)
过滤掉不必要的a 子元素
2019-01-08 19:50:32 +08:00

32 lines
902 B
JavaScript

const axios = require('../../utils/axios');
const cheerio = require('cheerio');
module.exports = async (ctx) => {
const response = await axios.get('http://www.dysfz.vip');
const $ = cheerio.load(response.data);
const list = $('.movie-list li').get();
const data = {
title: '电影首发站',
link: 'http://www.dysfz.vip',
description: '高清电影',
item: list.map((item) => ({
title: $(item)
.find('h2 a')
.text(),
description: $(item)
.find('.txt')
.text(),
pubDate: new Date(
$(item)
.find('.txt p>span:nth-child(1)')
.text()
).toUTCString(),
link: $(item)
.find('h2 a')
.attr('href'),
})),
};
ctx.state.data = data;
};