feat: deps cloudscraper -> hooman, close #4538

This commit is contained in:
DIYgod
2020-05-06 23:48:28 +08:00
parent 9cab64bf83
commit 0050f8882f
5 changed files with 97 additions and 35 deletions

View File

@@ -1,13 +1,13 @@
const url = require('url');
const cheerio = require('cheerio');
const cloudscraper = require('cloudscraper');
const got = require('hooman');
const dateUtil = require('@/utils/date');
// 通过传入不同的ctx.state.data.link 返回javlibrary 不同link的rss
exports.template = async function template(ctx) {
const link = ctx.state.data.link;
const response = await cloudscraper.get(link);
const $ = cheerio.load(response);
const response = await got.get(link);
const $ = cheerio.load(response.body);
const list = $('.videothumblist .video').get();
const items = await Promise.all(
@@ -20,8 +20,8 @@ exports.template = async function template(ctx) {
};
const details = await ctx.cache.tryGet(itemLink, async () => {
const response = await cloudscraper.get(itemLink);
const $ = cheerio.load(response);
const response = await got.get(itemLink);
const $ = cheerio.load(response.body);
$('#video_info #video_review .icon').remove();
return {
author: $('.star').text(),
@@ -40,8 +40,8 @@ exports.template = async function template(ctx) {
};
exports.getVideoComments = async function getVideoComments(link) {
const response = await cloudscraper.get(link);
const $ = cheerio.load(response);
const response = await got.get(link);
const $ = cheerio.load(response.body);
const list = $('#video_comments > table');
return (