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): support europechinese (DIYgod#15019)
* support europechinese * fix time
- Loading branch information
Showing
2 changed files
with
72 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,66 @@ | ||
import { Route } from '@/types'; | ||
import { load } from 'cheerio'; | ||
import cache from '@/utils/cache'; | ||
import got from '@/utils/got'; | ||
|
||
export const route: Route = { | ||
path: '/latest', | ||
categories: ['new-media'], | ||
example: '/europechinese/latest', | ||
parameters: {}, | ||
features: { | ||
requireConfig: false, | ||
requirePuppeteer: false, | ||
antiCrawler: false, | ||
supportBT: false, | ||
supportPodcast: false, | ||
supportScihub: false, | ||
}, | ||
radar: [ | ||
{ | ||
source: ['europechinese.blogspot.com'], | ||
}, | ||
], | ||
name: '最新', | ||
maintainers: ['emdoe'], | ||
handler, | ||
url: 'europechinese.blogspot.com/', | ||
}; | ||
|
||
async function handler() { | ||
const url = `https://europechinese.blogspot.com/`; | ||
const { data: response } = await got(url); | ||
const $ = load(response); | ||
const list = $('h3.post-title'); | ||
|
||
const out = await Promise.all( | ||
list.map((_, item) => { | ||
const title = $(item).find('a').text(); | ||
const link = $(item).find('a').attr('href'); | ||
|
||
return cache.tryGet(link, async () => { | ||
const { data: response } = await got(link); | ||
const $ = load(response); | ||
$('div.widget-content').remove(); | ||
$('div.byline').remove(); | ||
$('div.post-sidebar').remove(); | ||
const time = $('time.published').attr('datetime'); | ||
const text = $('div.post-body-container').html(); | ||
|
||
return { | ||
title, | ||
link, | ||
guid: link, | ||
description: text, | ||
pubDate: time, | ||
}; | ||
}); | ||
}) | ||
); | ||
|
||
return { | ||
title: `歐洲動態(國際)| 最新`, | ||
link: url, | ||
item: out, | ||
}; | ||
} |
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: '歐洲動態(國際)', | ||
url: 'europechinese.blogspot.com', | ||
}; |