forked from DIYgod/RSSHub
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(route): add dbaplus社群 (DIYgod#14925)
* feat(route): add dbaplus社群 * fix(route): fix dbaplus * fix(route): fix dbaplus社群 * Update rss.ts * Update rss.ts * Update rss.ts --------- Co-authored-by: pull[bot] <39814207+pull[bot]@users.noreply.github.com>
- Loading branch information
Showing
2 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import type { Namespace } from '@/types'; | ||
|
||
export const namespace: Namespace = { | ||
name: 'dbaplus社群', | ||
url: 'dbaplus.cn', | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { Route } from '@/types'; | ||
import { parseDate } from '@/utils/parse-date'; | ||
import got from '@/utils/got'; | ||
import { load } from 'cheerio'; | ||
|
||
export const route: Route = { | ||
path: '/', | ||
categories: ['programming'], | ||
example: '/dbaplus', | ||
radar: [ | ||
{ | ||
source: ['dbaplus.cn/'], | ||
}, | ||
], | ||
name: '最新文章', | ||
maintainers: ['cnkmmk'], | ||
handler, | ||
url: 'dbaplus.cn/', | ||
}; | ||
|
||
async function handler() { | ||
const url = 'https://dbaplus.cn'; | ||
const response = await got(`${url}/news-9-1.html`); | ||
const $ = load(response.data); | ||
|
||
const list = $('div.col-xs-12.col-md-8.pd30 > div.panel.panel-default.categeay > div.panel-body > ul.media-list.clearfix > li.media') | ||
.map((i, e) => { | ||
const element = $(e); | ||
const title = element.find('h3 > a').text(); | ||
const link = element.find('h3 > a').attr('href'); | ||
const description = element.find('div.mt10.geay').text(); | ||
const dateraw = element.find('span.time').text(); | ||
|
||
return { | ||
title, | ||
description, | ||
link, | ||
pubDate: parseDate(dateraw, 'YYYY年MM月DD日'), | ||
}; | ||
}) | ||
.get(); | ||
|
||
return { | ||
title: 'dbaplus社群', | ||
link: url, | ||
item: list, | ||
}; | ||
} |