parent
e2810f6d4e
commit
dbae9fbad7
|
|
@ -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;
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue