rsshub
Version:
Make RSS Great Again!
64 lines (62 loc) • 2.19 kB
JavaScript
import { n as init_esm_shims, t as __dirname } from "./esm-shims-CzJ_djXG.mjs";
import "./config-C37vj7VH.mjs";
import "./dist-BInvbO1W.mjs";
import "./logger-Czu8UMNd.mjs";
import "./ofetch-BIyrKU3Y.mjs";
import "./helpers-DxBp0Pty.mjs";
import { t as art } from "./render-BQo6B4tL.mjs";
import { t as got_default } from "./got-KxxWdaxq.mjs";
import path from "node:path";
//#region lib/routes/orcid/index.ts
init_esm_shims();
const route = {
path: "/:id",
categories: ["study"],
example: "/orcid/0000-0002-4731-9700",
parameters: { id: "Open Researcher and Contributor ID" },
features: {
requireConfig: false,
requirePuppeteer: false,
antiCrawler: false,
supportBT: false,
supportPodcast: false,
supportScihub: false
},
name: "Works List",
maintainers: ["OrangeEd1t"],
handler
};
async function handler(ctx) {
const id = ctx.req.param("id");
const currentUrl = `https://orcid.org/${id}/worksPage.json?offset=0&sort=date&sortAsc=false&pageSize=20`;
const items = (await got_default(currentUrl)).data.groups;
const works = [];
const out = [];
for (const item of items) for (let j = 0; j < item.works.length; j++) works.push(item.works[j]);
works.map((work) => {
let Str = "";
for (let l = 0; l < work.workExternalIdentifiers.length; l++) Str += work.workExternalIdentifiers[l].url ? "<a href=\"" + work.workExternalIdentifiers[l].url.value + "\">" + work.workExternalIdentifiers[l].externalIdentifierType.value + ": " + work.workExternalIdentifiers[l].externalIdentifierId.value + "</a><br>" : work.workExternalIdentifiers[l].externalIdentifierType.value + ": " + work.workExternalIdentifiers[l].externalIdentifierId.value + "<br>";
const info = {
title: work.title.value,
link: work.url,
description: art(path.join(__dirname, "templates/description-15487dd9.art"), {
title: work.title.value,
journalTitle: work.journalTitle?.value,
publicationDate: work.publicationDate,
workType: work.workType.value,
Str,
sourceName: work.sourceName
}),
guid: work.putCode.value
};
out.push(info);
return info;
});
return {
title: "ORCID Works List" + id,
link: currentUrl,
item: out
};
}
//#endregion
export { route };