feat: QQ 互联 SDK (#8421)
* feat: QQ SDK changelog * refactor: functional style * refactor: migrate to v2 Co-authored-by: TonyRL <TonyRL@users.noreply.github.com>
This commit is contained in:
parent
c9f1ed41f7
commit
76b3bba258
|
|
@ -638,47 +638,6 @@
|
|||
_name: 'eTOLAND',
|
||||
'.': [{ title: '主题贴', docs: 'https://docs.rsshub.app/bbs.html#etoland', source: ['/bbs/board.php', '/plugin/mobile/board.php'], target: (params, url) => `/etoland/${new URL(url).searchParams.get('bo_table')}` }],
|
||||
},
|
||||
'qq.com': {
|
||||
_name: '腾讯',
|
||||
'mp.weixin': [
|
||||
{
|
||||
title: '微信公众号栏目',
|
||||
docs: 'https://docs.rsshub.app/new-media.html#gong-zhong-hao-lan-mu-fei-tui-song-li-shi-xiao-xi',
|
||||
source: '/mp/homepage',
|
||||
target: (params, url) => `/wechat/mp/homepage/${new URL(url).searchParams.get('__biz')}/${new URL(url).searchParams.get('hid')}/${new URL(url).searchParams.get('cid') ? new URL(url).searchParams.get('cid') : ''}`,
|
||||
},
|
||||
{
|
||||
title: '微信公众号话题',
|
||||
docs: 'https://docs.rsshub.app/new-media.html#wei-xin-gong-zhong-hao-wen-zhang-hua-ti-tag',
|
||||
source: '/mp/appmsgalbum',
|
||||
target: (params, url) => `/wechat/mp/msgalbum/${new URL(url).searchParams.get('__biz')}/${new URL(url).searchParams.get('album_id')}`,
|
||||
},
|
||||
],
|
||||
egame: [
|
||||
{
|
||||
title: '企鹅电竞直播间',
|
||||
docs: 'https://docs.rsshub.app/live.html#qi-e-dian-jing-zhi-bo-jian-kai-bo',
|
||||
source: '/:id',
|
||||
target: (params) => {
|
||||
if (params.id.match(/^\d+$/)) {
|
||||
return '/egameqq/room/:id';
|
||||
}
|
||||
},
|
||||
},
|
||||
],
|
||||
v: [
|
||||
{
|
||||
title: '视频 - 播放列表',
|
||||
docs: 'https://docs.rsshub.app/multimedia.html#teng-xun-shi-pin',
|
||||
source: '/x/cover/:id',
|
||||
target: (params) => {
|
||||
const id = params.id.match('(.*).html')[1];
|
||||
return id ? `/tencentvideo/playlist/${id}` : '';
|
||||
},
|
||||
},
|
||||
{ title: '视频 - 播放列表', docs: 'https://docs.rsshub.app/multimedia.html#teng-xun-shi-pin', source: '/x/cover/:id/:detail', target: '/tencentvideo/playlist/:id' },
|
||||
],
|
||||
},
|
||||
'onejav.com': {
|
||||
_name: 'OneJAV BT',
|
||||
'.': [
|
||||
|
|
|
|||
|
|
@ -366,6 +366,12 @@ pageClass: routes
|
|||
|
||||
</Route>
|
||||
|
||||
## QQ 互联 SDK
|
||||
|
||||
### 更新日志
|
||||
|
||||
<Route author="nuomi1" example="/tencent/qq/sdk/changelog/iOS" path="/tencent/qq/sdk/changelog/:platform" :paramsDesc="['平台,iOS / Android']"/>
|
||||
|
||||
## QTTabBar
|
||||
|
||||
### Change Log
|
||||
|
|
|
|||
|
|
@ -1658,52 +1658,6 @@ module.exports = {
|
|||
},
|
||||
],
|
||||
},
|
||||
'qq.com': {
|
||||
_name: '腾讯',
|
||||
'mp.weixin': [
|
||||
{
|
||||
title: '微信公众号栏目',
|
||||
docs: 'https://docs.rsshub.app/new-media.html#gong-zhong-hao-lan-mu-fei-tui-song-li-shi-xiao-xi',
|
||||
source: '/mp/homepage',
|
||||
target: (params, url) => `/wechat/mp/homepage/${new URL(url).searchParams.get('__biz')}/${new URL(url).searchParams.get('hid')}/${new URL(url).searchParams.get('cid') ? new URL(url).searchParams.get('cid') : ''}`,
|
||||
},
|
||||
{
|
||||
title: '微信公众号话题',
|
||||
docs: 'https://docs.rsshub.app/new-media.html#wei-xin-gong-zhong-hao-wen-zhang-hua-ti-tag',
|
||||
source: '/mp/appmsgalbum',
|
||||
target: (params, url) => `/wechat/mp/msgalbum/${new URL(url).searchParams.get('__biz')}/${new URL(url).searchParams.get('album_id')}`,
|
||||
},
|
||||
],
|
||||
egame: [
|
||||
{
|
||||
title: '企鹅电竞直播间',
|
||||
docs: 'https://docs.rsshub.app/live.html#qi-e-dian-jing-zhi-bo-jian-kai-bo',
|
||||
source: '/:id',
|
||||
target: (params) => {
|
||||
if (params.id.match(/^\d+$/)) {
|
||||
return '/egameqq/room/:id';
|
||||
}
|
||||
},
|
||||
},
|
||||
],
|
||||
v: [
|
||||
{
|
||||
title: '视频 - 播放列表',
|
||||
docs: 'https://docs.rsshub.app/multimedia.html#teng-xun-shi-pin',
|
||||
source: '/x/cover/:id',
|
||||
target: (params) => {
|
||||
const id = params.id.match('(.*).html')[1];
|
||||
return id ? `/tencentvideo/playlist/${id}` : '';
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '视频 - 播放列表',
|
||||
docs: 'https://docs.rsshub.app/multimedia.html#teng-xun-shi-pin',
|
||||
source: '/x/cover/:id/:detail',
|
||||
target: '/tencentvideo/playlist/:id',
|
||||
},
|
||||
],
|
||||
},
|
||||
'onejav.com': {
|
||||
_name: 'OneJAV BT',
|
||||
'.': [
|
||||
|
|
|
|||
|
|
@ -0,0 +1,3 @@
|
|||
module.exports = {
|
||||
'/qq/sdk/changelog/:platform': ['nuomi1'],
|
||||
};
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const platform = ctx.params.platform;
|
||||
|
||||
let title = '';
|
||||
let link = '';
|
||||
if (platform === 'iOS') {
|
||||
title = 'iOS SDK 历史变更';
|
||||
link = 'https://wiki.connect.qq.com/ios_sdk历史变更';
|
||||
} else if (platform === 'Android') {
|
||||
title = 'Android SDK 历史变更';
|
||||
link = 'https://wiki.connect.qq.com/android_sdk历史变更';
|
||||
} else {
|
||||
throw Error('not support platform');
|
||||
}
|
||||
|
||||
const response = await got.get(link);
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
|
||||
// 获取主要文本,并且过滤空行
|
||||
const contents = $('.wp-editor')
|
||||
.children('p')
|
||||
.filter((_, element) => $(element).text() !== '');
|
||||
|
||||
const pList = [];
|
||||
const titleIndex = [];
|
||||
|
||||
// 遍历文本 p 标签,并且获取标题索引
|
||||
contents.each((index, element) => {
|
||||
if ($(element).find('strong').length) {
|
||||
titleIndex.push(index);
|
||||
}
|
||||
|
||||
pList.push($(element).text().replace('\n', ''));
|
||||
});
|
||||
|
||||
// 用标题索引切割数组
|
||||
const changelogs = titleIndex.map((_, index) => {
|
||||
const section = pList.slice(titleIndex[index], titleIndex[index + 1]);
|
||||
const changelog = {
|
||||
title: section[0],
|
||||
description: section.slice(1).join('\n'),
|
||||
};
|
||||
|
||||
return changelog;
|
||||
});
|
||||
|
||||
ctx.state.data = {
|
||||
title,
|
||||
link,
|
||||
item: changelogs,
|
||||
};
|
||||
};
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
module.exports = {
|
||||
'qq.com': {
|
||||
_name: '腾讯',
|
||||
'mp.weixin': [
|
||||
{
|
||||
title: '微信公众号栏目',
|
||||
docs: 'https://docs.rsshub.app/new-media.html#gong-zhong-hao-lan-mu-fei-tui-song-li-shi-xiao-xi',
|
||||
source: '/mp/homepage',
|
||||
target: (params, url) => `/wechat/mp/homepage/${new URL(url).searchParams.get('__biz')}/${new URL(url).searchParams.get('hid')}/${new URL(url).searchParams.get('cid') ? new URL(url).searchParams.get('cid') : ''}`,
|
||||
},
|
||||
{
|
||||
title: '微信公众号话题',
|
||||
docs: 'https://docs.rsshub.app/new-media.html#wei-xin-gong-zhong-hao-wen-zhang-hua-ti-tag',
|
||||
source: '/mp/appmsgalbum',
|
||||
target: (params, url) => `/wechat/mp/msgalbum/${new URL(url).searchParams.get('__biz')}/${new URL(url).searchParams.get('album_id')}`,
|
||||
},
|
||||
],
|
||||
egame: [
|
||||
{
|
||||
title: '企鹅电竞直播间',
|
||||
docs: 'https://docs.rsshub.app/live.html#qi-e-dian-jing-zhi-bo-jian-kai-bo',
|
||||
source: '/:id',
|
||||
target: (params) => {
|
||||
if (params.id.match(/^\d+$/)) {
|
||||
return '/egameqq/room/:id';
|
||||
}
|
||||
},
|
||||
},
|
||||
],
|
||||
v: [
|
||||
{
|
||||
title: '视频 - 播放列表',
|
||||
docs: 'https://docs.rsshub.app/multimedia.html#teng-xun-shi-pin',
|
||||
source: '/x/cover/:id',
|
||||
target: (params) => {
|
||||
const id = params.id.match('(.*).html')[1];
|
||||
return id ? `/tencentvideo/playlist/${id}` : '';
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '视频 - 播放列表',
|
||||
docs: 'https://docs.rsshub.app/multimedia.html#teng-xun-shi-pin',
|
||||
source: '/x/cover/:id/:detail',
|
||||
target: '/tencentvideo/playlist/:id',
|
||||
},
|
||||
],
|
||||
'wiki.connect': [
|
||||
{
|
||||
title: 'QQ 互联 SDK 更新日志',
|
||||
docs: 'https://docs.rsshub.app/program-update.html#qq-hu-lian-sdk',
|
||||
source: '/',
|
||||
target: (_params, url) => `/tencent/qq/sdk/changelog/${new URL(url).pathname === '/ios_sdk历史变更' ? 'iOS' : 'Android'}`,
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
module.exports = (router) => {
|
||||
router.get('/qq/sdk/changelog/:platform', require('./qq/sdk/changelog'));
|
||||
};
|
||||
Loading…
Reference in New Issue