feat(route): add Bitmovin blogs (#8935)
* Add(route): add Bitmovin blogs * refactor: migrate to v2 Co-authored-by: TonyRL <TonyRL@users.noreply.github.com>
This commit is contained in:
parent
0ac081aad0
commit
c30a4d56fc
|
|
@ -66,6 +66,12 @@ Category
|
|||
|
||||
<RouteEn author="elxy" example="/bbcnewslabs/news" path="/bbcnewslabs/news"/>
|
||||
|
||||
## Bitmovin
|
||||
|
||||
### Blog
|
||||
|
||||
<RouteEn author="elxy" example="/bitmovin/blog" path="/bitmovin/blog"/>
|
||||
|
||||
## Codeforces
|
||||
|
||||
### Latest contests
|
||||
|
|
|
|||
|
|
@ -80,6 +80,12 @@ Rated 对象
|
|||
|
||||
<Route author="elxy" example="/bbcnewslabs/news" path="/bbcnewslabs/news"/>
|
||||
|
||||
## Bitmovin
|
||||
|
||||
### Blog
|
||||
|
||||
<Route author="elxy" example="/bitmovin/blog" path="/bitmovin/blog"/>
|
||||
|
||||
## Codeforces
|
||||
|
||||
#### 最新比赛
|
||||
|
|
|
|||
|
|
@ -0,0 +1,33 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const rootUrl = 'https://bitmovin.com/blog/';
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: rootUrl,
|
||||
});
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
|
||||
const items = $('div.blog-posts article')
|
||||
.slice()
|
||||
.map((_, item) => {
|
||||
item = $(item);
|
||||
return {
|
||||
title: item.find('h2 a').text(),
|
||||
author: item.find('li.post-author span a').text(),
|
||||
description: item.find('div.entry p').text(),
|
||||
pubDate: parseDate(item.find('li.post-date').text()),
|
||||
link: item.find('h2 a').attr('href'),
|
||||
};
|
||||
})
|
||||
.get();
|
||||
|
||||
ctx.state.data = {
|
||||
title: 'Blog - Bitmovin',
|
||||
link: rootUrl,
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
module.exports = {
|
||||
'/blog': ['elxy'],
|
||||
};
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
module.exports = {
|
||||
'bitmovin.com': {
|
||||
_name: 'Bitmovin',
|
||||
'.': [
|
||||
{
|
||||
title: 'Blog',
|
||||
docs: 'https://docs.rsshub.app/programming.html#bitmovin',
|
||||
source: ['/blog', '/'],
|
||||
target: '/bitmovin/blog',
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
module.exports = (router) => {
|
||||
router.get('/blog', require('./blog'));
|
||||
};
|
||||
Loading…
Reference in New Issue