feat(route): add two blogs: Stratechery & Miris Whispers (#9496)

* Add two blogs

* fix(utils): add parseDate timezone common-config

* Update lib/v2/stratechery/index.js

Co-authored-by: Tony <TonyRL@users.noreply.github.com>

* Update docs/blog.md

Co-authored-by: Tony <TonyRL@users.noreply.github.com>

* Update docs/en/blog.md

Co-authored-by: Tony <TonyRL@users.noreply.github.com>

* Update lib/v2/miris/blog.js
This commit is contained in:
Chenxing Luo 2022-04-08 11:48:28 -04:00 committed by GitHub
parent 6996efd070
commit ef94bcde8e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 87 additions and 0 deletions

View File

@ -80,6 +80,10 @@ pageClass: routes
<Route author="xyqfer" example="/leemeng" path="/leemeng"/>
## Miris Whispers
<Route author="chazeon" example="/miris/blog" path="/miris/blog" />
## Paul Graham 博客
通过提取文章全文,提供比官方源更佳的阅读体验。
@ -106,6 +110,10 @@ pageClass: routes
:::
## Stratechery by Ben Thompson
<Route author="chazeon" example="/stratechery" path="/stratechery" />
## Whoscall
### 最新文章

View File

@ -40,6 +40,10 @@ pageClass: routes
<RouteEn author="james-tindal" example="/ash-maurya" path="/ash-maurya"/>
## Miris Whispers
<RouteEn author="chazeon" example="/miris/blog" path="/miris/blog" />
## Paul Graham
### Essays
@ -66,6 +70,10 @@ Limit the number of entries to be retrieved by adding `?limit=x` to the end of t
<RouteEn author="CitrusIce" example="/phrack" path="/phrack" />
## Stratechery by Ben Thompson
<RouteEn author="chazeon" example="/stratechery" path="/stratechery" />
## WordPress
<RouteEn author="Lonor" example="/blogs/wordpress/lawrence.code.blog" path="/blogs/wordpress/:domain/:https?" :paramsDesc="['WordPress blog domain', 'use https by default. options: `http` or `https`']"/>

View File

@ -3,6 +3,10 @@ const got = require('@/utils/got');
const iconv = require('iconv-lite');
// eslint-disable-next-line no-unused-vars
const date = require('@/utils/date');
// eslint-disable-next-line no-unused-vars
const { parseDate } = require('@/utils/parse-date');
// eslint-disable-next-line no-unused-vars
const timezone = require('@/utils/timezone');
function transElemText($, prop) {
const regex = new RegExp(/\$\((.*)\)/g);

19
lib/v2/miris/blog.js Normal file
View File

@ -0,0 +1,19 @@
const buildData = require('@/utils/common-config');
module.exports = async (ctx) => {
const link = 'https://blog.miris.design/';
ctx.state.data = await buildData({
link,
url: link,
title: 'Miris Whisper',
author: 'Miris',
description: 'Esoteric technical and sometimes personal stuff...',
item: {
item: 'ul > li',
title: `$('li > a').contents().filter(function () { return this.type === 'text' }).text()`,
link: `$('li > a').attr('href')`,
pubDate: `parseDate($('li > a > .date').text().slice(1, 11))`,
},
});
};

11
lib/v2/miris/radar.js Normal file
View File

@ -0,0 +1,11 @@
module.exports = {
'miris.design': {
_name: 'Miris',
blog: [
{
title: 'Miris Whispers',
docs: 'https://docs.rsshub.app/en/blog.html#miris-design',
},
],
},
};

3
lib/v2/miris/router.js Normal file
View File

@ -0,0 +1,3 @@
module.exports = function (router) {
router.get('/blog', require('./blog'));
};

View File

@ -0,0 +1,20 @@
const buildData = require('@/utils/common-config');
module.exports = async (ctx) => {
const link = 'https://stratechery.com/';
ctx.state.data = await buildData({
link,
url: link,
title: 'Stratechery by Ben Thompson',
author: 'Ben Thompson',
description: 'Stratechery provides analysis of the strategy and business side of technology and media, and the impact of technology on society. ',
item: {
item: 'article',
title: `$('article > header > h1 > a').text()`,
link: `$('article > header > h1 > a').attr('href')`,
pubDate: `parseDate($('article .entry-date').attr('datetime'))`,
description: `$('article > .entry-content').html().replace(/%/g, '&percnt;')`,
},
});
};

View File

@ -0,0 +1,11 @@
module.exports = {
'miris.design': {
_name: 'Stratechery by Ben Thompson',
blog: [
{
title: 'Articles',
docs: 'https://docs.rsshub.app/en/blog.html#stratechery-by-ben-thompson',
},
],
},
};

View File

@ -0,0 +1,3 @@
module.exports = function (router) {
router.get('/', require('.'));
};