style: auto format

This commit is contained in:
GitHub Action
2021-03-02 05:19:55 +00:00
parent 79546d4c67
commit cd4c872161
7 changed files with 56 additions and 57 deletions
+1 -1
View File
@@ -2746,7 +2746,7 @@
source: ['/users/:username/collection/:type/added', '/users/:username/collection'],
target: (params) => `/trakt/collection/${params.username}/${params.type || 'all'}`,
},
],
],
},
'eagle.cool': {
_name: 'Eagle',
+6 -6
View File
@@ -623,18 +623,18 @@ pageClass: routes
## subHD.tv - 最新字幕
<Route author="laampui" example="/subhd/newest" path="/subhd/newest" />
## Yahoo! テレビ
### 番組検索
<Route author="sakamossan" example="/yahoo-jp-tv/%E8%8A%B1%E6%BE%A4%E9%A6%99%E8%8F%9C" path="/yahoo-jp-tv/:query" :paramsDesc="['搜索查询']"/>
## Trakt.tv
### 用户收藏
<Route author="hoilc" example="/trakt/collection/tomyangsh/movies" path="/trakt/collection/:username/:type?" :paramsDesc="['用户名','收藏类型,可选`movies`,`shows`,`episodes`,`all`,默认为`all`']" radar="1" rssbud="1" />
## Yahoo! テレビ
### 番組検索
<Route author="sakamossan" example="/yahoo-jp-tv/%E8%8A%B1%E6%BE%A4%E9%A6%99%E8%8F%9C" path="/yahoo-jp-tv/:query" :paramsDesc="['搜索查询']"/>
## YouTube
见 [#youtube](/social-media.html#youtube)
+2 -2
View File
@@ -155,8 +155,8 @@ pageClass: routes
<Route author="E1nzbern" example="/bjtu/gs/all" path="/bjtu/gs/:type" :paramsDesc="['文章类别']">
| 所有文章 | 通知公告 | 新闻动态 | 招生宣传 | 培养 | 学位 | 招生 | 硕士招生 | 博士招生 | 招生简章 | 招生政策法规 | 研工部通知公告 | 研工部新闻动态 |
| ---- | -------- | -------- | ------------ | ------------ | -------- | -------- | ------ | ---------- | ------ | ------ | ------ | ------ |
| all | noti | news | zsxc | py | xw | zs | sszs | bszs | zsjz | zcfg | ygbtzgg | ygbnews |
| -------- | -------- | -------- | -------- | ---- | ---- | ---- | -------- | -------- | -------- | ------------ | -------------- | -------------- |
| all | noti | news | zsxc | py | xw | zs | sszs | bszs | zsjz | zcfg | ygbtzgg | ygbnews |
</Route>
+24 -25
View File
@@ -2,37 +2,36 @@ const got = require('@/utils/got');
const cheerio = require('cheerio');
module.exports = async (ctx) => {
const URL = `https://www.books.com.tw/web/${ctx.params.category}/`;
const {data} = await got({
const { data } = await got({
method: 'get',
url: URL
url: URL,
});
const $ = cheerio.load(data);
const list = $('div.mod_a div.wrap div.item');
const items = list.map((i, item) => {
item = $(item);
const title = item.find('h4').text().trim();
let imgLink = item.find('a img.cover').attr('src').trim();
imgLink = imgLink.slice(imgLink.indexOf('https', 1), imgLink.indexOf('.jpg') + 4);
const link = item.find('a').attr('href');
const desc = item.find('div.txt_cont p').text().trim();
const author = item.find('li.info>a').text();
const publisher = item.find('li.info span>a').text();
const pubInfo = item.find('li.info').text();
let price = item.find('ul.price li.set2 strong');
price = price.length === 1 ? parseInt(price.text().trim()) :
parseInt(price.eq(0).text() > 10 ? (price.eq(1).text() * 100 / price.eq(0).text()).toFixed() :
(price.eq(1).text() * 10 / price.eq(0).text()).toFixed());
return {
title,
description: `${desc}<br><img src="${imgLink}" alt="${title}"><br>NT$${price}元<br>${pubInfo}`,
link: link.slice(0, link.indexOf('?')),
author: `${author} / ${publisher}`,
};
}).get();
const items = list
.map((i, item) => {
item = $(item);
const title = item.find('h4').text().trim();
let imgLink = item.find('a img.cover').attr('src').trim();
imgLink = imgLink.slice(imgLink.indexOf('https', 1), imgLink.indexOf('.jpg') + 4);
const link = item.find('a').attr('href');
const desc = item.find('div.txt_cont p').text().trim();
const author = item.find('li.info>a').text();
const publisher = item.find('li.info span>a').text();
const pubInfo = item.find('li.info').text();
let price = item.find('ul.price li.set2 strong');
price = price.length === 1 ? parseInt(price.text().trim()) : parseInt(price.eq(0).text() > 10 ? ((price.eq(1).text() * 100) / price.eq(0).text()).toFixed() : ((price.eq(1).text() * 10) / price.eq(0).text()).toFixed());
return {
title,
description: `${desc}<br><img src="${imgLink}" alt="${title}"><br>NT$${price}元<br>${pubInfo}`,
link: link.slice(0, link.indexOf('?')),
author: `${author} / ${publisher}`,
};
})
.get();
ctx.state.data = {
title: $('title').text(),
link: URL,
item: items
item: items,
};
};
+2 -4
View File
@@ -2,7 +2,7 @@ const got = require('@/utils/got');
const cheerio = require('cheerio');
module.exports = async (ctx) => {
const url = `https://trakt.tv/users/${ctx.params.username}/collection/${ctx.params.type || 'all'}/added`;
const url = `https://trakt.tv/users/${ctx.params.username}/collection/${ctx.params.type || 'all'}/added`;
const response = await got(url);
const $ = cheerio.load(response.data);
@@ -17,9 +17,7 @@ module.exports = async (ctx) => {
const item = $(single);
const title = item.find('.titles > h3').text();
const link = item.find('meta[itemprop="url"]').attr('content');
const poster = item
.find('.poster > meta')
.attr('content');
const poster = item.find('.poster > meta').attr('content');
const pubDate = new Date(item.find('.titles .format-date').attr('data-date'));
return {
title,
+19 -16
View File
@@ -9,91 +9,91 @@ module.exports = async (ctx) => {
list: '.mainleft_box li',
},
url: 'https://gs.bjtu.edu.cn/cms/zszt/item/?tag=1',
name: '招生 - 北京交通大学研究生院'
name: '招生 - 北京交通大学研究生院',
},
noti: {
selector: {
list: '.tab-content li',
},
url: 'https://gs.bjtu.edu.cn/cms/item/?tag=2',
name: '通知公告 - 北京交通大学研究生院'
name: '通知公告 - 北京交通大学研究生院',
},
news: {
selector: {
list: '.tab-content li',
},
url: 'https://gs.bjtu.edu.cn/cms/item/?tag=3',
name: '新闻动态 - 北京交通大学研究生院'
name: '新闻动态 - 北京交通大学研究生院',
},
zsxc: {
selector: {
list: '.tab-content li',
},
url: 'https://gs.bjtu.edu.cn/cms/item/?tag=4',
name: '招生宣传 - 北京交通大学研究生院'
name: '招生宣传 - 北京交通大学研究生院',
},
py: {
selector: {
list: '.tab-content li',
},
url: 'https://gs.bjtu.edu.cn/cms/item/?tag=5',
name: '培养 - 北京交通大学研究生院'
name: '培养 - 北京交通大学研究生院',
},
xw: {
selector: {
list: '.tab-content li',
},
url: 'https://gs.bjtu.edu.cn/cms/item/?tag=7',
name: '学位 - 北京交通大学研究生院'
name: '学位 - 北京交通大学研究生院',
},
ygbtzgg: {
selector: {
list: '.tab-content li',
},
url: 'https://gs.bjtu.edu.cn/cms/item/?tag=9',
name: '通知公告 - 研工部 - 北京交通大学研究生院'
name: '通知公告 - 研工部 - 北京交通大学研究生院',
},
ygbnews: {
selector: {
list: '.tab-content li',
},
url: 'https://gs.bjtu.edu.cn/cms/item/?tag=10',
name: '新闻动态 - 研工部 - 北京交通大学研究生院'
name: '新闻动态 - 研工部 - 北京交通大学研究生院',
},
all: {
selector: {
list: '.tab-content li',
},
url: 'https://gs.bjtu.edu.cn/cms/item/?tag=12',
name: '所有文章 - 北京交通大学研究生院'
name: '所有文章 - 北京交通大学研究生院',
},
bszs: {
selector: {
list: '.mainleft_box li',
},
url: 'https://gs.bjtu.edu.cn/cms/zszt/item/?cat=2',
name: '博士招生 - 北京交通大学研究生院'
name: '博士招生 - 北京交通大学研究生院',
},
sszs: {
selector: {
list: '.mainleft_box li',
},
url: 'https://gs.bjtu.edu.cn/cms/zszt/item/?cat=3',
name: '硕士招生 - 北京交通大学研究生院'
name: '硕士招生 - 北京交通大学研究生院',
},
zsjz: {
selector: {
list: '.mainleft_box li',
},
url: 'https://gs.bjtu.edu.cn/cms/zszt/item/?cat=4',
name: '招生简章 - 北京交通大学研究生院'
name: '招生简章 - 北京交通大学研究生院',
},
zcfg: {
selector: {
list: '.mainleft_box li',
},
url: 'https://gs.bjtu.edu.cn/cms/zszt/item/?cat=5',
name: '政策法规 - 北京交通大学研究生院'
name: '政策法规 - 北京交通大学研究生院',
},
};
@@ -117,11 +117,14 @@ module.exports = async (ctx) => {
list
.map((index, item) => {
item = $(item);
const date = new Date(Date.parse(item.find('li span').text().slice(1, 11).replace(/-/g, "/")));
const date = new Date(Date.parse(item.find('li span').text().slice(1, 11).replace(/-/g, '/')));
const bj_date = date.getTime() / 1000 + 8 * 60 * 60;
const title = item.find('li a').text().replace(/\[.*?\]/g, '');
const title = item
.find('li a')
.text()
.replace(/\[.*?\]/g, '');
return { title: title, description: title, link: item.find('li a').attr('href'), pubDate: new Date(parseInt(bj_date) * 1000) };
})
.get(),
};
};
};
+2 -3
View File
@@ -16,7 +16,7 @@ module.exports = async (ctx) => {
// 知乎专栏链接存在两种格式, 一种以 'zhuanlan.' 开头, 另一种新增的以 'c_' 结尾
let url = `https://zhuanlan.zhihu.com/${id}`;
if (id.search("c_") === 0) {
if (id.search('c_') === 0) {
url = `https://www.zhihu.com/column/${id}`;
}
@@ -58,8 +58,7 @@ module.exports = async (ctx) => {
// 判断是否存在视频简介
if (item.description) {
description = `${item.description} <br> <br> <a href="${link}">视频内容请跳转至原页面观看</a>`;
}
else {
} else {
description = `<a href="${link}">视频内容请跳转至原页面观看</a>`;
}
}