Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update the fork #1

Merged
merged 45 commits into from
Mar 17, 2019
Merged
Changes from 1 commit
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
1f59667
fix failed route: universities/hust/
budui Mar 5, 2019
9adee55
delete duplicate router
budui Mar 5, 2019
3d63f93
fix: 修复文档 (#1700)
HenryQW Mar 8, 2019
6775a28
牛客网全文链接 移除随显示位置变化的param (#1702)
lalxyy Mar 8, 2019
66afb56
chore(deps): update dependency jest to v24.3.1 (#1703)
renovate[bot] Mar 8, 2019
41f94cd
修复知乎图片重复问题 & 知乎日报h2标签处理逻辑 (#1704)
jyboy Mar 8, 2019
a538a9c
对电影天堂增加全文抓取 (#1697)
junfengP Mar 8, 2019
f25cb90
Merge branch 'master' of https://github.com/RayHY/RSSHub into RayHY-m…
DIYgod Mar 8, 2019
b559b76
Merge branch 'RayHY-master'
DIYgod Mar 8, 2019
f8990b7
The cherrio config route (#1699)
SettingDust Mar 11, 2019
0abd80a
fix 后续app route (#1705)
ciaranchen Mar 11, 2019
9f96dcf
🐰 Add 中华人民共和国生态环境部公告 (#1707)
billyct Mar 11, 2019
b3d9380
Hotfix: dajia (#1709)
xyqfer Mar 11, 2019
16f1499
Add: douyin like (#1710)
xyqfer Mar 11, 2019
68b5e7f
[Dockerhub] Fix date and guid (#1717)
imlonghao Mar 11, 2019
718686f
[Zhihu - Activities] Add type roundtable (#1719)
imlonghao Mar 11, 2019
54752af
煎蛋无聊图链接修复 (#1720)
imlonghao Mar 11, 2019
412d549
fix: shmtu routes (#1721)
simonsmh Mar 11, 2019
08ae336
Add: tg channel photo (#1714)
xyqfer Mar 11, 2019
776fb0b
[new RSS] Add routes/blogs/jingwei_link for blog https://jingwei.link…
a180285 Mar 11, 2019
c105b41
fix: xidian 路由 (#1731)
ciaranchen Mar 12, 2019
1788bdb
Update dependency jest to v24.4.0 (#1732)
renovate[bot] Mar 12, 2019
43c5c95
MP4BA (#1711)
SettingDust Mar 12, 2019
5eab3a4
fix null cache type, close #1728 #1730
DIYgod Mar 12, 2019
03f47d9
add maitta route (#1725)
fengkx Mar 12, 2019
1a8b5b3
Add 好奇心日报 (#1735)
WenhuWee Mar 12, 2019
e505e46
:sparkles: 小黑盒新闻、打折情况,游戏时光新闻、发售表 (#1736)
Mar 13, 2019
c4430e2
fix 好奇心日报图片无法显示 (#1739)
WenhuWee Mar 13, 2019
34a4de4
chore(deps): update dependency jest to v24.5.0 (#1738)
renovate[bot] Mar 13, 2019
1d957fc
fix(deps): update dependency googleapis to v38 (#1740)
renovate[bot] Mar 13, 2019
909b0fd
add 今日热榜 (#1741)
LogicJake Mar 13, 2019
7c72d91
fix 今日哈工大 哈工大教务处 截取错误 (#1742)
ranpox Mar 13, 2019
af1df7f
fix splice
DIYgod Mar 13, 2019
1c79842
fix $ get
DIYgod Mar 13, 2019
db41c6d
update 12306 no item limit (#1743)
LogicJake Mar 13, 2019
58065a3
fix(deps): update dependency rss-parser to v3.7.0 (#1745)
renovate[bot] Mar 14, 2019
2a0e9f8
add: 「刷屏-最新」路由无中间页版 (#1747)
yefoenix Mar 15, 2019
9d08020
Update README.md (#1748)
ChungZH Mar 15, 2019
7b59a6c
fix: wrong Dcard parameter (#1751)
HenryQW Mar 15, 2019
5314586
feat: update docker-compose.yml (#1754)
HenryQW Mar 15, 2019
ec5d67d
fix 今日头条search (#1755)
LogicJake Mar 15, 2019
9ff9636
fix 后续 lives (#1756)
LogicJake Mar 15, 2019
7231663
add 知乎周刊 (#1757)
LogicJake Mar 15, 2019
6434934
fix 什么值得买排行榜为空报错 (#1758)
LogicJake Mar 15, 2019
b9cdc5e
add: 好奇心日报支持 tag 路由 (#1759)
sivagao Mar 15, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: xidian 路由 (DIYgod#1731)
  • Loading branch information
ciaranchen authored and DIYgod committed Mar 12, 2019
commit c105b41ab5d938ebbee7b58aeb3ee7ce67f529e8
69 changes: 34 additions & 35 deletions lib/routes/universities/xidian/jwc.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,48 +13,47 @@ module.exports = async (ctx) => {
const data = response.data;

const $ = cheerio.load(data);
let list = $('td[bgcolor="#ffffff"]')
.first()
.children();
const list = $('#__01 > tbody > tr > td:nth-child(2)');
const titleTables = list.children().filter((index) => index % 2 !== 1);

list = list
.filter((index) => index % 2 !== 0)
.splice(0, 10)
.map((index, item) => {
this.index = index;
item = $(item);
return item
.find('tr')
.find('tr')
.map((index, item) => {
item = $(item);
return {
title: item.find('a').attr('title'),
description: arrC[this.index] + '<br>' + item.find('a').attr('title') + '<br><br>全文内容需使用校园网或VPN获取',
pubDate: new Date(
item
.children()
.last()
.text()
).toUTCString(),
link: `https://jwc.xidian.edu.cn/${item.find('a').attr('href')}`,
};
});
})
.get();
let result = [];
if (category === 'all' && arrE.indexOf(category) === -1) {
for (let i = 0; i < list.length; i++) {
result = result.concat(list[i].get());
}
const parseTable = (index, item) => {
const title = arrC[index];
const aTags = $(item)
.next()
.find('a');
return aTags
.map((_, item) => {
item = $(item);
return {
title: item.attr('title'),
description: title + '<br/>' + item.attr('title') + '<br/>全文内容需使用校园网或VPN获取',
pubDate: new Date(
item
.parent()
.next()
.text()
).toUTCString(),
link: `https://jwc.xidian.edu.cn/${item.attr('href')}`,
};
})
.get();
};

const arrIndex = arrE.indexOf(category);
let result;
if (arrIndex === -1) {
result = titleTables.map(parseTable).get();
result.sort((a, b) => new Date(b.pubDate) - new Date(a.pubDate));
} else {
result = list[arrE.indexOf(category)].get();
result = parseTable(arrIndex, titleTables[arrIndex]);
}

ctx.state.data = {
title: '西电教务处',
link: 'https://jwc.xidian.edu.cn',
description: $('meta[Name="keywords"]').attr('Content'),
description: $('title')
.text()
.concat(arrIndex === -1 ? '' : '-' + arrC[arrIndex]),
item: result,
};
};