Skip to content

Commit

Permalink
Merge pull request #1375 from DIYgod/master
Browse files Browse the repository at this point in the history
[pull] master from diygod:master
  • Loading branch information
pull[bot] authored May 4, 2024
2 parents 8c93911 + 8d10679 commit 9a4c6ea
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 3 deletions.
4 changes: 2 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ updates:
directory: '/'
schedule:
interval: daily
time: '21:00'
time: '08:00'
open-pull-requests-limit: 10
labels:
- dependencies
Expand All @@ -16,7 +16,7 @@ updates:
directory: '/'
schedule:
interval: daily
time: '21:00'
time: '08:00'
open-pull-requests-limit: 10
labels:
- dependencies
5 changes: 4 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ permissions:
contents: read

jobs:
fix-pnpmp-lock:
fix-pnpm-lock:
# workaround for https://github.com/dependabot/dependabot-core/issues/7258
# until https://github.com/pnpm/pnpm/issues/6530 is fixed
if: github.triggering_actor == 'dependabot[bot]' && github.event_name == 'pull_request'
Expand All @@ -38,6 +38,9 @@ jobs:
- uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: 'chore: fix pnpm install'
commit_user_name: dependabot[bot]
commit_user_email: 49699333+dependabot[bot]@users.noreply.github.com
commit_author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

vitest:
runs-on: ubuntu-latest
Expand Down
6 changes: 6 additions & 0 deletions lib/routes/digitalcameraworld/namespace.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import type { Namespace } from '@/types';

export const namespace: Namespace = {
name: 'Digital Camera World',
url: 'digitalcameraworld.com',
};
61 changes: 61 additions & 0 deletions lib/routes/digitalcameraworld/news.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import { Route } from '@/types';
import { load } from 'cheerio';
import { ofetch } from 'ofetch';
import { parseDate } from '@/utils/parse-date';
const host = 'https://www.digitalcameraworld.com';
export const route: Route = {
path: '/news',
categories: ['new-media'],
example: '/digitalcameraworld/news',
parameters: {},
features: {
requireConfig: false,
requirePuppeteer: false,
antiCrawler: false,
supportBT: false,
supportPodcast: false,
supportScihub: false,
},
radar: [
{
source: ['digitalcameraworld.com/'],
},
],
name: 'News',
maintainers: ['EthanWng97'],
handler,
};

async function handler() {
const rssUrl = `${host}/feeds.xml`;

const response = await ofetch(rssUrl);

const $ = load(response, {
xmlMode: true,
});

const items = $('item')
.toArray()
.map((item) => {
item = $(item);
let description = item.find('dc\\:content').text();
description = $('<div>').html(description);
description.find('.vanilla-image-block').removeAttr('style');
description.find('.fancy-box').remove();

return {
title: item.find('title').text(),
pubDate: parseDate(item.find('pubDate').text()),
link: item.find('link').text(),
description: description.html(),
};
});

return {
title: 'Digital Camera World',
link: host,
description: 'Camera news, reviews and features',
item: items,
};
}

0 comments on commit 9a4c6ea

Please sign in to comment.