fix: remove pornhub preview video (#5555)

This commit is contained in:
I2IMk
2020-09-02 13:41:51 +01:00
committed by GitHub
parent 176690cce4
commit da8b008c80
+4 -9
View File
@@ -5,18 +5,13 @@ module.exports = async (ctx) => {
const url = ctx.params.url || 'video';
const link = `https://www.pornhub.com/${url}`;
const response = await got.get(link, {
headers: {
// set ua to "Safari" to get preview videos in mp4 format, instead of webm
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1 Safari/605.1.15',
},
});
const response = await got.get(link);
const $ = cheerio.load(response.data);
const list = $('.nf-videos .videoBox');
ctx.state.data = {
title: $('title').text(),
url: link,
title: $('title').first().text(),
link: link,
item:
list &&
list
@@ -26,7 +21,7 @@ module.exports = async (ctx) => {
return {
title: e.find('span.title a').text(),
link: `https://www.pornhub.com` + e.find('span.title a').attr('href'),
description: `<video controls loop src=${e.find('img').attr('data-mediabook')} poster=${e.find('img').attr('src')}>`,
description: `<img src=${e.find('img').attr('src')}>`,
};
})
.get(),