mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-02 10:08:02 +08:00
* Initial commit of route Penguin Random House * WIP: parse books into templates * Updated radar info * Added articles route * Renamed the route and added docs * Update lib/v2/penguin-random-house/articles.js according to suggestion Co-authored-by: Tony <TonyRL@users.noreply.github.com> * Changed category to Reading, added En docs * Changed pubDate format * Update lib/v2/penguin-random-house/router.js Co-authored-by: Tony <TonyRL@users.noreply.github.com> * Update lib/v2/penguin-random-house/articles.js Co-authored-by: Tony <TonyRL@users.noreply.github.com> * Update lib/v2/penguin-random-house/thereaddown.js Co-authored-by: Tony <TonyRL@users.noreply.github.com> * Parse time * Fallback on failed regex matches * Fallback date to undefined * Update lib/v2/penguin-random-house/utils.js Co-authored-by: Tony <TonyRL@users.noreply.github.com> * fix: radar domain
28 lines
894 B
JavaScript
28 lines
894 B
JavaScript
const utils = require('./utils');
|
|
const cheerio = require('cheerio');
|
|
const got = require('@/utils/got');
|
|
|
|
module.exports = async (ctx) => {
|
|
const link = 'https://www.penguinrandomhouse.com/the-read-down/';
|
|
const res = await got(link);
|
|
const $ = cheerio.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);
|
|
|
|
ctx.state.data = {
|
|
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,
|
|
};
|
|
};
|