原站发生了迁移,于是改了一下
This commit is contained in:
Awater 2019-03-27 11:08:11 +08:00 committed by DIYgod
parent e2810f6d4e
commit dbae9fbad7
1 changed files with 15 additions and 9 deletions

View File

@ -2,30 +2,36 @@ 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();
let responseData = '';
for (let index = 1; index <= 5; index++) {
responseData =
responseData +
(await axios.get(`http://www.wuhaozhan.net/movie/list/?p=${index}`, {
params: { p: index },
})).data;
}
const $ = cheerio.load(responseData);
const list = $('.pure-u-16-24').get();
const data = {
title: '电影首发站',
link: 'http://www.dysfz.vip',
link: 'http://www.wuhaozhan.net/movie/list/',
description: '高清电影',
item: list.map((item) => ({
title: $(item)
.find('h2 a')
.find('h2')
.text(),
description: $(item)
.find('.txt')
.find('.l-des')
.text(),
pubDate: new Date(
$(item)
.find('.txt p>span:nth-child(1)')
.find('.dt')
.text()
).toUTCString(),
link: $(item)
.find('h2 a')
.find('.l-a')
.attr('href'),
})),
};
ctx.state.data = data;
};