Merge pull request #6569 from nczitzk/feature/anytxt

feat: add anytxt release notes
This commit is contained in:
NeverBehave
2021-01-10 03:48:10 -05:00
committed by GitHub
4 changed files with 49 additions and 0 deletions
+6
View File
@@ -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
+6
View File
@@ -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
+4
View File
@@ -3789,6 +3789,9 @@ 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'));
// 鱼塘热榜
router.get('/mofish/:id', require('./routes/mofish/index'));
@@ -3823,4 +3826,5 @@ router.get('/rfa/:language?/:channel?/:subChannel?', require('./routes/rfa/index
// booth.pm
router.get('/booth.pm/shop/:subdomain', require('./routes/booth-pm/shop'));
module.exports = router;
+33
View File
@@ -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,
};
};