Skip to content

Commit

Permalink
fix(common-config): add bacl parseDate and timezone
Browse files Browse the repository at this point in the history
  • Loading branch information
Tony committed Sep 19, 2024
1 parent 5ba095d commit 02efe69
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions lib/utils/common-config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { load } from 'cheerio';
import ofetch from '@/utils/ofetch';
import iconv from 'iconv-lite';
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import { parseDate } from '@/utils/parse-date';
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import timezone from '@/utils/timezone';

function transElemText($, prop) {
const regex = /\$\((.*)\)/g;
Expand Down Expand Up @@ -56,18 +60,16 @@ async function buildData(data) {
title: getProp(data, 'title', $),
description: getProp(data, 'description', $),
allowEmpty: data.allowEmpty || false,
item: $item
.map((_, e) => {
const $elem = (selector) => $(e).find(selector);
return {
title: getProp(data, ['item', 'title'], $elem),
description: getProp(data, ['item', 'description'], $elem),
pubDate: getProp(data, ['item', 'pubDate'], $elem),
link: getProp(data, ['item', 'link'], $elem),
guid: getProp(data, ['item', 'guid'], $elem),
};
})
.get(),
item: $item.toArray().map((e) => {
const $elem = (selector) => $(e).find(selector);
return {
title: getProp(data, ['item', 'title'], $elem),
description: getProp(data, ['item', 'description'], $elem),
pubDate: getProp(data, ['item', 'pubDate'], $elem),
link: getProp(data, ['item', 'link'], $elem),
guid: getProp(data, ['item', 'guid'], $elem),
};
}),
};
}

Expand Down

0 comments on commit 02efe69

Please sign in to comment.