Files
RSSHub/lib/routes/swjtu/utils.ts
T
DIYgod 83e701b592 feat: compile ts through tsdown (#18908)
* feat: build ts via tsdown

* feat: exec tsdown

* fix

* fix

* fix

* feat: use tsdown shims

* chore: run rolldown lifecycle script

* fix: use shims

---------
2025-04-22 22:29:11 +08:00

30 lines
913 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import got from '@/utils/got';
import { art } from '@/utils/render';
import { parseDate } from '@/utils/parse-date';
import path from 'node:path';
const renderDetail = (jobs) => art(path.join(__dirname, 'templates/job_detail.art'), { jobs });
const renderDesc = (intro) =>
art(path.join(__dirname, 'templates/job_desc.art'), {
intro,
job_list: renderDetail(intro.zwxxList),
});
const descpPage = (link, cache) =>
cache.tryGet(link, async () => {
const data = await got({
method: 'post',
url: link,
});
const intro = data.data.data;
return {
title: `${intro.dwmc}(${intro.xzyjmc})`,
pubDate: parseDate(String(intro.fbrq)),
description: renderDesc(intro),
link: String(link.replace('data', 'view')),
};
});
export default { descpPage, renderDetail, renderDesc };