Files
RSSHub/lib/v2/lever/index.js
github-actions[bot] 57ea542ff4 style: auto format
2022-05-20 16:11:58 +00:00

29 lines
996 B
JavaScript

const got = require('@/utils/got');
const { parseDate } = require('@/utils/parse-date');
// Initiate a HTTP GET request
module.exports = async (ctx) => {
const domain = ctx.params.domain;
const response = await got(`https://api.lever.co/v0/postings/${domain}?mode=json`);
const data = response.data;
ctx.state.data = {
// the source title
title: `${domain}'s Job feed in RSS`,
// the source link
link: `https://api.lever.co/v0/postings/${domain}`,
// the source description
description: `Auto Generated RSS Spec for ${domain}`,
// iterate through all leaf objects
item: data.map((item) => ({
// the article title
title: item.text,
// the article content
description: item.descriptionPlain,
// the article publish time
pubDate: parseDate(item.createdAt),
// the article link
link: item.hostedUrl,
})),
};
};