feat: add Amazfit Watch Faces (#5037)
This commit is contained in:
@@ -9,6 +9,31 @@ pageClass: routes
|
||||
### 新闻
|
||||
|
||||
<Route author="cc798461" example="/acwifi" path="/acwifi"/>
|
||||
|
||||
## Amazfit Watch Faces
|
||||
|
||||
手表型号可在网站中选择后到地址栏查看
|
||||
|
||||
| Amazfit Bip | Amazfit Cor | Amazfit GTR | Amazfit GTS | Amazfit Stratos | Amazfit T-Rex | Amazfit Verge | Amazfit Verge Lite | Honor Band 5 | Honor Watch Magic | Huawei Watch GT | Xiaomi Mi Band 4 |
|
||||
| ----------- | ----------- | ----------- | ----------- | --------------- | ------------- | ------------- | ------------------ | ------------ | ----------------- | --------------- | ---------------- |
|
||||
| bip | cor | gtr | gts | pace | t-rex | verge | verge-lite | honor-band-5 | honor-watch-magic | huawei-watch-gt | mi-band-4 |
|
||||
|
||||
### 新品上架
|
||||
|
||||
<Route author="nczitzk" example="/amazfitwatchfaces/fresh/bip/Bip/zh" path="/amazfitwatchfaces/fresh/:model/:type?/:lang?" :paramsDesc="['手表型号', '手表款式,款式代码可在目标网站选择后到地址栏查看,`all` 指 全部款式', '表盘语言,语言代码可在目标网站选择后到地址栏查看,如 `zh` 指 中文']"/>
|
||||
|
||||
### 最近更新
|
||||
|
||||
<Route author="nczitzk" example="/amazfitwatchfaces/updated/bip/Bip/zh" path="/amazfitwatchfaces/updated/:model/:type?/:lang?" :paramsDesc="['手表型号', '手表款式,款式代码可在目标网站选择后到地址栏查看,`all` 指 全部款式', '表盘语言,语言代码可在目标网站选择后到地址栏查看,如 `zh` 指 中文']"/>
|
||||
|
||||
### 排行榜
|
||||
|
||||
<Route author="nczitzk" example="/amazfitwatchfaces/top/bip/Bip/month/views/zh" path="/amazfitwatchfaces/top/:model/:type?/:time?/:sortBy?/:lang?" :paramsDesc="['手表型号', '手表款式,款式代码可在目标网站选择后到地址栏查看,`all` 指 全部款式', '统计时间,`week` 指 上周,`month` 指 上月,`alltime` 指 全部时间', '排序参数,`download` 指 下载量,`views` 指 查看量,`fav` 指 收藏数', '表盘语言,语言代码可在目标网站选择后到地址栏查看,如 `zh` 指 中文']"/>
|
||||
|
||||
### 搜索结果
|
||||
|
||||
<Route author="nczitzk" example="/amazfitwatchfaces/search/bip/battery" path="/amazfitwatchfaces/search/:model/:keyword?/:sortBy?" :paramsDesc="['手表型号', '关键词,多个关键词用半角逗号隔开', '排序参数,`fresh` 指 新品上架,`updated` 指 已更新的,`views` 指 查看量,`download` 指 下载量,`fav` 指 收藏数']"/>
|
||||
|
||||
## Apple
|
||||
|
||||
### 更换和维修扩展计划
|
||||
|
||||
@@ -2871,6 +2871,12 @@ router.get('/changku', require('./routes/changku/index'));
|
||||
// 上海市生态环境局
|
||||
router.get('/gov/shanghai/sthj', require('./routes/gov/shanghai/sthj'));
|
||||
|
||||
// Amazfit Watch Faces
|
||||
router.get('/amazfitwatchfaces/fresh/:model/:type?/:lang?', require('./routes/amazfitwatchfaces/fresh'));
|
||||
router.get('/amazfitwatchfaces/updated/:model/:type?/:lang?', require('./routes/amazfitwatchfaces/updated'));
|
||||
router.get('/amazfitwatchfaces/top/:model/:type?/:time?/:sortBy?/:lang?', require('./routes/amazfitwatchfaces/top'));
|
||||
router.get('/amazfitwatchfaces/search/:model/:keyword?/:sortBy?', require('./routes/amazfitwatchfaces/search'));
|
||||
|
||||
// 猫耳FM
|
||||
router.get('/missevan/drama/:id', require('./routes/missevan/drama'));
|
||||
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
const utils = require('./utils');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const currentUrl = `${ctx.params.model}/fresh?${ctx.params.lang ? 'lang=' + ctx.params.lang : ''}${ctx.params.type ? '&compatible=' + ctx.params.type : ''}`;
|
||||
|
||||
ctx.state.data = await utils(ctx, currentUrl);
|
||||
};
|
||||
@@ -0,0 +1,7 @@
|
||||
const utils = require('./utils');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const currentUrl = `search/${ctx.params.model}/tags/${ctx.params.keyword ? ctx.params.keyword : ''}${ctx.params.sortBy ? '?sortby=' + ctx.params.sortBy : ''}`;
|
||||
|
||||
ctx.state.data = await utils(ctx, currentUrl);
|
||||
};
|
||||
@@ -0,0 +1,9 @@
|
||||
const utils = require('./utils');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const currentUrl = `${ctx.params.model}/top?${ctx.params.lang ? 'lang=' + ctx.params.lang : ''}${ctx.params.type ? '&compatible=' + ctx.params.type : ''}${ctx.params.sortBy ? '&sortby=' + ctx.params.sortBy : ''}${
|
||||
ctx.params.time ? '&topof=' + ctx.params.time : ''
|
||||
}`;
|
||||
|
||||
ctx.state.data = await utils(ctx, currentUrl);
|
||||
};
|
||||
@@ -0,0 +1,7 @@
|
||||
const utils = require('./utils');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const currentUrl = `${ctx.params.model}/updated?${ctx.params.lang ? 'lang=' + ctx.params.lang : ''}${ctx.params.type ? '&compatible=' + ctx.params.type : ''}`;
|
||||
|
||||
ctx.state.data = await utils(ctx, currentUrl);
|
||||
};
|
||||
@@ -0,0 +1,44 @@
|
||||
const url = require('url');
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx, currentUrl) => {
|
||||
const rootUrl = `https://amazfitwatchfaces.com/`;
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: `${rootUrl}${currentUrl}`,
|
||||
});
|
||||
const $ = cheerio.load(response.data);
|
||||
const list = $('#wf-row div.col-md-3')
|
||||
.slice(0, 10)
|
||||
.map((_, item) => {
|
||||
item = $(item);
|
||||
return {
|
||||
link: url.resolve(rootUrl, $(item).find('a.wf-act').attr('href')),
|
||||
};
|
||||
})
|
||||
.get();
|
||||
|
||||
const items = await Promise.all(
|
||||
list.map(
|
||||
async (item) =>
|
||||
await ctx.cache.tryGet(item.link, async () => {
|
||||
const detailResponse = await got({ method: 'get', url: item.link });
|
||||
const content = cheerio.load(detailResponse.data);
|
||||
const date = content('i.fa-calendar').parent().find('span').text();
|
||||
const ymd = date.split(' ')[0];
|
||||
|
||||
item.title = `[${content('code').text()}] ${content('title').text().split(' - ')[0]}`;
|
||||
item.description = `<img src="${content('#watchface-preview').attr('src')}"><br>${content('div.unicodebidi').text()}`;
|
||||
item.pubDate = new Date(`${ymd.split('.')[2]}-${ymd.split('.')[1]}-${ymd.split('.')[0]} ${date.split(' ')[1]}`).toUTCString();
|
||||
return item;
|
||||
})
|
||||
)
|
||||
);
|
||||
|
||||
return {
|
||||
title: `${$('title').text().split('|')[0]} | Amazfit Watch Faces`,
|
||||
link: currentUrl,
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user