mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-11 15:47:48 +08:00
feat(route): add Android SDK Platform Tools release notes (#10264)
* feat(route): add Android SDK Platform Tools release notes * fix typo * fix links
This commit is contained in:
@@ -4,6 +4,12 @@ pageClass: routes
|
|||||||
|
|
||||||
# Application Updates
|
# Application Updates
|
||||||
|
|
||||||
|
## Android
|
||||||
|
|
||||||
|
### SDK Platform Tools release notes
|
||||||
|
|
||||||
|
<RouteEn author="nczitzk" example="/android/platform-tools-releases" path="/android/platform-tools-releases"/>
|
||||||
|
|
||||||
## Anki
|
## Anki
|
||||||
|
|
||||||
### Changes
|
### Changes
|
||||||
|
|||||||
@@ -14,6 +14,12 @@ pageClass: routes
|
|||||||
|
|
||||||
</Route>
|
</Route>
|
||||||
|
|
||||||
|
## Android
|
||||||
|
|
||||||
|
### SDK Platform Tools release notes
|
||||||
|
|
||||||
|
<Route author="nczitzk" example="/android/platform-tools-releases" path="/android/platform-tools-releases"/>
|
||||||
|
|
||||||
## Anki
|
## Anki
|
||||||
|
|
||||||
### Changes
|
### Changes
|
||||||
|
|||||||
3
lib/v2/android/maintainer.js
Normal file
3
lib/v2/android/maintainer.js
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
module.exports = {
|
||||||
|
'/platform-tools-releases': ['nczitzk'],
|
||||||
|
};
|
||||||
47
lib/v2/android/platform-tools-releases.js
Normal file
47
lib/v2/android/platform-tools-releases.js
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
const got = require('@/utils/got');
|
||||||
|
const cheerio = require('cheerio');
|
||||||
|
const { parseDate } = require('@/utils/parse-date');
|
||||||
|
|
||||||
|
module.exports = async (ctx) => {
|
||||||
|
const rootUrl = 'https://developer.android.com';
|
||||||
|
const currentUrl = `${rootUrl}/studio/releases/platform-tools`;
|
||||||
|
|
||||||
|
const response = await got({
|
||||||
|
method: 'get',
|
||||||
|
url: currentUrl,
|
||||||
|
headers: {
|
||||||
|
cookie: 'signin=autosignin',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const $ = cheerio.load(response.data);
|
||||||
|
|
||||||
|
$('.hide-from-toc').remove();
|
||||||
|
$('.devsite-dialog, .devsite-badge-awarder, .devsite-hats-survey').remove();
|
||||||
|
|
||||||
|
const items = $('h4')
|
||||||
|
.toArray()
|
||||||
|
.map((item) => {
|
||||||
|
item = $(item);
|
||||||
|
|
||||||
|
const title = item.attr('data-text');
|
||||||
|
|
||||||
|
let description = '';
|
||||||
|
item.nextUntil('h4').each(function () {
|
||||||
|
description += $(this).html();
|
||||||
|
});
|
||||||
|
|
||||||
|
return {
|
||||||
|
title,
|
||||||
|
description,
|
||||||
|
link: `${currentUrl}#${item.attr('id')}`,
|
||||||
|
pubDate: parseDate(title.match(/\((.*)\)/)[1], 'MMMM YYYY'),
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
ctx.state.data = {
|
||||||
|
title: $('title').text(),
|
||||||
|
link: currentUrl,
|
||||||
|
item: items,
|
||||||
|
};
|
||||||
|
};
|
||||||
13
lib/v2/android/radar.js
Normal file
13
lib/v2/android/radar.js
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
module.exports = {
|
||||||
|
'android.com': {
|
||||||
|
_name: 'Android Developers',
|
||||||
|
developer: [
|
||||||
|
{
|
||||||
|
title: 'SDK Platform Tools release notes',
|
||||||
|
docs: 'https://docs.rsshub.app/program-update.html#android-sdk-platform-tools-release-notes',
|
||||||
|
source: ['/studio/releases/platform-tools', '/'],
|
||||||
|
target: '/android/platform-tools-releases',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
};
|
||||||
3
lib/v2/android/router.js
Normal file
3
lib/v2/android/router.js
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
module.exports = function (router) {
|
||||||
|
router.get('/platform-tools-releases', require('./platform-tools-releases'));
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user