From da8b008c8071a16834913e266301bd23ee6a9dbb Mon Sep 17 00:00:00 2001 From: I2IMk <66695371+I2IMk@users.noreply.github.com> Date: Wed, 2 Sep 2020 20:41:51 +0800 Subject: [PATCH] fix: remove pornhub preview video (#5555) --- lib/routes/pornhub/category_url.js | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/lib/routes/pornhub/category_url.js b/lib/routes/pornhub/category_url.js index 40b55620f..d3640d843 100644 --- a/lib/routes/pornhub/category_url.js +++ b/lib/routes/pornhub/category_url.js @@ -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: `