feat: add anytxt release notes
This commit is contained in:
parent
b1ae777b87
commit
d27fc7c73c
|
|
@ -10,6 +10,12 @@ pageClass: routes
|
|||
|
||||
<Route author="nczitzk" example="/anki/changes" path="/anki/changes"/>
|
||||
|
||||
## AnyTXT
|
||||
|
||||
### Release Notes
|
||||
|
||||
<Route author="nczitzk" example="/anytxt/release-notes" path="/anytxt/release-notes"/>
|
||||
|
||||
## Apkpure
|
||||
|
||||
### Versions
|
||||
|
|
|
|||
|
|
@ -20,6 +20,12 @@ pageClass: routes
|
|||
|
||||
<Route author="nczitzk" example="/anki/changes" path="/anki/changes"/>
|
||||
|
||||
## AnyTXT
|
||||
|
||||
### Release Notes
|
||||
|
||||
<Route author="nczitzk" example="/anytxt/release-notes" path="/anytxt/release-notes"/>
|
||||
|
||||
## Apkpure
|
||||
|
||||
### Versions
|
||||
|
|
|
|||
|
|
@ -3780,4 +3780,7 @@ router.get('/nace/blog/:sort?', require('./routes/nace/blog'));
|
|||
// Caixin Latest
|
||||
router.get('/caixin/latest', require('./routes/caixin/latest'));
|
||||
|
||||
// AnyTXT
|
||||
router.get('/anytxt/release-notes', require('./routes/anytxt/release-notes'));
|
||||
|
||||
module.exports = router;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,33 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const rootUrl = 'https://anytxt.net';
|
||||
const currentUrl = `${rootUrl}/download`;
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: currentUrl,
|
||||
});
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
|
||||
const items = $('.has-medium-font-size')
|
||||
.map((_, item) => {
|
||||
item = $(item);
|
||||
const date = item.text().replace(':', '');
|
||||
|
||||
return {
|
||||
title: date,
|
||||
link: currentUrl,
|
||||
pubDate: new Date(date).toUTCString(),
|
||||
description: `<ol>${item.next().html()}</ol>`,
|
||||
};
|
||||
})
|
||||
.get();
|
||||
|
||||
ctx.state.data = {
|
||||
title: 'Release Notes - AnyTXT',
|
||||
link: currentUrl,
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
Loading…
Reference in New Issue