feat(route): add ui.dev newsletter archives: reactnewsletter.com and bytes.dev (#11499)
* feat(route): add ui.dev reactnewsletter.com and bytes.dev * fix(route): split reactnewsletter.com and bytes.dev into separate routes * fix(route): typo * fix: add missing radar and maintainer.js
This commit is contained in:
parent
0cdbb26ddb
commit
0572e4a59e
|
|
@ -420,3 +420,17 @@ Subscribe to the updates (threads and submission) from a paritcular Hacker News
|
|||
### weekly
|
||||
|
||||
<RouteEn author="Pulset" example="/zooTeam/weekly" path="/zooTeam/weekly" radar="1" rssbud="1"/>
|
||||
|
||||
## ui.dev
|
||||
|
||||
### BYTES - Your weekly dose of JS
|
||||
|
||||
Staying informed on the JavaScript ecosystem has never been so entertaining. Delivered every Monday and Thursday, for free. https://bytes.dev/
|
||||
|
||||
<RouteEn author="meixger" example="/bytes" path="/bytes"/>
|
||||
|
||||
### React Newsletter
|
||||
|
||||
Stay up to date on the latest React news, tutorials, resources, and more. Delivered every Tuesday, for free. https://reactnewsletter.com/
|
||||
|
||||
<RouteEn author="meixger" example="/reactnewsletter" path="/reactnewsletter"/>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,25 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const currentURL = 'https://bytes.dev/archives';
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const resp = await got(currentURL);
|
||||
const $ = cheerio.load(resp.data);
|
||||
const text = $('script#__NEXT_DATA__').text();
|
||||
const json = JSON.parse(text);
|
||||
const posts = [json.props.pageProps.featuredPost].concat(json.props.pageProps.posts);
|
||||
const items = posts.map((item) => ({
|
||||
title: `Issue ${item.slug}`,
|
||||
pubDate: parseDate(item.date),
|
||||
description: item.title,
|
||||
link: `/archives/${item.slug}`,
|
||||
}));
|
||||
|
||||
ctx.state.data = {
|
||||
title: 'bytes.dev',
|
||||
description: 'Your weekly dose of JS',
|
||||
link: currentURL,
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
module.exports = {
|
||||
'': ['meixger'],
|
||||
'/': ['meixger'],
|
||||
};
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
module.exports = {
|
||||
'bytes.dev': {
|
||||
_name: 'ui.dev',
|
||||
'.': [
|
||||
{
|
||||
title: 'BYTES - Your weekly dose of JS',
|
||||
docs: 'https://docs.rsshub.app/en/programming.html#ui-dev-bytes',
|
||||
source: ['/archives', '/'],
|
||||
target: '/bytes',
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
module.exports = function (router) {
|
||||
router.get('/', require('./bytes'));
|
||||
};
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
module.exports = {
|
||||
'': ['meixger'],
|
||||
'/': ['meixger'],
|
||||
};
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
module.exports = {
|
||||
'bytes.dev': {
|
||||
_name: 'ui.dev',
|
||||
'.': [
|
||||
{
|
||||
title: 'React Newsletter',
|
||||
docs: 'https://docs.rsshub.app/en/programming.html#ui-dev-bytes',
|
||||
source: ['/issues', '/'],
|
||||
target: '/reactnewsletter',
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const currentURL = 'https://reactnewsletter.com/issues';
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const resp = await got(currentURL);
|
||||
const $ = cheerio.load(resp.data);
|
||||
const text = $('script#__NEXT_DATA__').text();
|
||||
const json = JSON.parse(text);
|
||||
|
||||
const items = json.props.pageProps.issues.map((item) => ({
|
||||
title: item.title,
|
||||
pubDate: parseDate(item.date),
|
||||
description: item.summary,
|
||||
link: `/issues/${item.slug}`,
|
||||
}));
|
||||
|
||||
ctx.state.data = {
|
||||
title: 'reactnewsletter.dev',
|
||||
description: 'Stay up to date on the latest React news, tutorials, resources, and more. Delivered every Tuesday, for free.',
|
||||
link: currentURL,
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
module.exports = function (router) {
|
||||
router.get('/', require('./reactnewsletter'));
|
||||
};
|
||||
Loading…
Reference in New Issue