Skip to content

Commit

Permalink
feat: AWS blogs (DIYgod#12076)
Browse files Browse the repository at this point in the history
* feat: AWS blogs

* chore: change as requested

* docs: fix heading

---------
  • Loading branch information
HankChow authored Mar 14, 2023
1 parent e4ae95e commit 63da6d6
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 0 deletions.
12 changes: 12 additions & 0 deletions docs/blog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,18 @@ pageClass: routes

# 博客

## Amazon

### AWS 博客

<Route author="HankChow" example="/amazon/awsblogs" path="/awsblogs/:locale?" :paramsDesc="['指定语言的博客文章,仅支持以下选项,默认为 `zh_CN`']">

| zh_CN | en_US | fr_FR | de_DE | ja_JP | ko_KR | pt_BR | es_ES | ru_RU | id_ID | tr_TR |
| ----- | ----- | ----- | ----- | ----- | ----- | ----- | ----- | ----- | ----- | ----- |
| 汉语 | 英语 | 法语 | 德语 | 日语 | 韩语 | 葡萄牙语 | 西班牙语 | 俄语 | 印尼语 | 土耳其语 |

</Route>

## archdaily

### 首页
Expand Down
12 changes: 12 additions & 0 deletions docs/en/blog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,18 @@ pageClass: routes

# Blog

## Amazon

### AWS Blogs

<RouteEn author="HankChow" example="/amazon/awsblogs" path="/awsblogs/:locale?" :paramsDesc="['Blog postes in a specified language, only the following options are supported. Default `zh_CN`']">

| zh_CN | en_US | fr_FR | de_DE | ja_JP | ko_KR | pt_BR | es_ES | ru_RU | id_ID | tr_TR |
| ----- | ----- | ----- | ----- | ----- | ----- | ----- | ----- | ----- | ----- | ----- |
| Chinese | English | French | German | Japanese | Korean | Portuguese | Spainish | Russian | Indonesian | Turkish |

</RouteEn>

## archdaily

### Home
Expand Down
27 changes: 27 additions & 0 deletions lib/v2/amazon/awsblogs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
const got = require('@/utils/got');
const { parseDate } = require('@/utils/parse-date');

module.exports = async (ctx) => {
const locale = ctx.params.locale ?? 'zh_CN';

const response = await got({
url: `https://aws.amazon.com/api/dirs/items/search?item.directoryId=blog-posts&sort_by=item.additionalFields.createdDate&sort_order=desc&size=50&item.locale=${locale}`,
});

const items = response.data.items;

ctx.state.data = {
title: 'AWS Blog',
link: 'https://aws.amazon.com/blogs/',
description: 'AWS Blog 更新',
item:
items &&
items.map((item) => ({
title: item.item.additionalFields.title,
description: item.item.additionalFields.postExcerpt,
pubDate: parseDate(item.item.dateCreated),
link: item.item.additionalFields.link,
author: item.item.additionalFields.contributors,
})),
};
};
1 change: 1 addition & 0 deletions lib/v2/amazon/maintainer.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
module.exports = {
'/awsblogs/:locale?': ['HankChow'],
'/kindle/software-updates': ['NavePnow'],
};
6 changes: 6 additions & 0 deletions lib/v2/amazon/radar.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,11 @@ module.exports = {
},
},
],
aws: [
{
title: 'AWS blogs',
docs: 'https://docs.rsshub.app/blogs.html#amazon',
},
],
},
};
1 change: 1 addition & 0 deletions lib/v2/amazon/router.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
module.exports = function (router) {
router.get('/awsblogs/:locale?', require('./awsblogs'));
router.get('/kindle/software-updates', require('./kindle-software-updates'));
};

0 comments on commit 63da6d6

Please sign in to comment.