/
thereaddown.ts
52 lines (47 loc) 路 1.44 KB
/
thereaddown.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import { Route } from '@/types';
import utils from './utils';
import { load } from 'cheerio';
import got from '@/utils/got';
export const route: Route = {
path: '/the-read-down',
categories: ['reading'],
example: '/penguin-random-house/the-read-down',
parameters: {},
features: {
requireConfig: false,
requirePuppeteer: false,
antiCrawler: false,
supportBT: false,
supportPodcast: false,
supportScihub: false,
},
radar: [
{
source: ['penguinrandomhouse.com/the-read-down'],
},
],
name: 'Book Lists',
maintainers: ['StevenRCE0'],
handler,
url: 'penguinrandomhouse.com/the-read-down',
};
async function handler(ctx) {
const link = 'https://www.penguinrandomhouse.com/the-read-down/';
const res = await got(link);
const $ = load(res.data);
const itemArray = $('.archive-module-half-container,.archive-module-third-container')
.map(function () {
return {
url: $(this).find('a').attr('href'),
title: $(this).find('.archive-module-text').first().text(),
};
})
.get();
const out = await utils.parseList(itemArray, ctx, utils.parseBooks);
return {
title: 'Penguin Random House Book Lists',
link,
description: 'Never wonder what to read next! Check out these lists to find your next favorite book.',
item: out,
};
}