mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-19 06:38:55 +08:00
feat: BT之家RSS | feat: 浙江大学城市学院计算分院全局搜索,新闻全文 (#3680)
This commit is contained in:
@@ -37,6 +37,25 @@ pageClass: routes
|
|||||||
|
|
||||||
见 [#bilibili](/social-media.html#bilibili)
|
见 [#bilibili](/social-media.html#bilibili)
|
||||||
|
|
||||||
|
## BT 之家
|
||||||
|
|
||||||
|
### 最新种子
|
||||||
|
|
||||||
|
<Route author="zhang-wangz" example="/btzj/base" path="/btzj/:type?" anticrawler="1" :paramsDesc="['type,见下表']">
|
||||||
|
|
||||||
|
| base | govern |
|
||||||
|
| ------------------------ | ---------------------- |
|
||||||
|
| https://www.88btbtt.com/ | http://www.1btjia.com/ |
|
||||||
|
|
||||||
|
</Route>
|
||||||
|
|
||||||
|
::: tip 提示
|
||||||
|
|
||||||
|
由于 BT 之家域名有多个. 此 feed 对应[`https://www.88btbtt.com`](https://www.88btbtt.com)域名和[`http://www.1btjia.com/`](http://www.1btjia.com/)域名.
|
||||||
|
可空,默认为 base
|
||||||
|
|
||||||
|
:::
|
||||||
|
|
||||||
## EZTV
|
## EZTV
|
||||||
|
|
||||||
::: tip 提示
|
::: tip 提示
|
||||||
|
|||||||
@@ -1096,7 +1096,18 @@ https://rsshub.app/**nuist**/`bulletin` 或 https://rsshub.app/**nuist**/`bullet
|
|||||||
|
|
||||||
### 新闻通知
|
### 新闻通知
|
||||||
|
|
||||||
<Route author="zhang-wangz" example="/zucc/news/latest" path="/zucc/news/latest"></Route>
|
<Route author="zhang-wangz" example="/zucc/news/latest" path="/zucc/news/latest">
|
||||||
|
</Route>
|
||||||
|
|
||||||
|
### 计算分院全站搜索
|
||||||
|
|
||||||
|
<Route author="zhang-wangz" example="/zucc/cssearch/latest/0/白卡" path="/zucc/cssearch/latest/:webVpn?/:key?" :paramsDesc="['见下表(默认为0)','关键词(默认为白卡)']">
|
||||||
|
|
||||||
|
| 0 | 1 |
|
||||||
|
| ------------------ | -------------------- |
|
||||||
|
| 文章地址为正常地址 | 获取的是 webvpn 地址 |
|
||||||
|
|
||||||
|
</Route>
|
||||||
|
|
||||||
## 浙江工商大学
|
## 浙江工商大学
|
||||||
|
|
||||||
|
|||||||
@@ -793,6 +793,9 @@ router.get('/kirara/news', require('./routes/kirara/news'));
|
|||||||
router.get('/dytt', require('./routes/dytt/index'));
|
router.get('/dytt', require('./routes/dytt/index'));
|
||||||
router.get('/dytt/index', require('./routes/dytt/index')); // 兼容
|
router.get('/dytt/index', require('./routes/dytt/index')); // 兼容
|
||||||
|
|
||||||
|
// BT之家
|
||||||
|
router.get('/btzj/:type?', require('./routes/btzj/index'));
|
||||||
|
|
||||||
// 人生05电影网
|
// 人生05电影网
|
||||||
router.get('/rs05/rs05', require('./routes/rs05/rs05'));
|
router.get('/rs05/rs05', require('./routes/rs05/rs05'));
|
||||||
|
|
||||||
@@ -1322,6 +1325,7 @@ router.get('/zju/cst/:type', require('./routes/universities/zju/cst'));
|
|||||||
|
|
||||||
// 浙江大学城市学院
|
// 浙江大学城市学院
|
||||||
router.get('/zucc/news/latest', require('./routes/universities/zucc/news'));
|
router.get('/zucc/news/latest', require('./routes/universities/zucc/news'));
|
||||||
|
router.get('/zucc/cssearch/latest/:webVpn/:key/', require('./routes/universities/zucc/cssearch'));
|
||||||
|
|
||||||
// 华中师范大学
|
// 华中师范大学
|
||||||
router.get('/ccnu/career', require('./routes/universities/ccnu/career'));
|
router.get('/ccnu/career', require('./routes/universities/ccnu/career'));
|
||||||
|
|||||||
77
lib/routes/btzj/index.js
Normal file
77
lib/routes/btzj/index.js
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
const got = require('@/utils/got');
|
||||||
|
const cheerio = require('cheerio');
|
||||||
|
const iconv = require('iconv-lite');
|
||||||
|
|
||||||
|
const maps = {
|
||||||
|
base: 'https://www.88btbtt.com/',
|
||||||
|
govern: 'http://www.1btjia.com/',
|
||||||
|
};
|
||||||
|
// const baseSuffix = 'forum-index-fid-951.htm';
|
||||||
|
async function load(link, type, ctx) {
|
||||||
|
const cache = await ctx.cache.get(link);
|
||||||
|
if (cache) {
|
||||||
|
return JSON.parse(cache);
|
||||||
|
}
|
||||||
|
const response = await got({
|
||||||
|
method: 'get',
|
||||||
|
url: link,
|
||||||
|
responseType: 'buffer',
|
||||||
|
});
|
||||||
|
const responseHtml = iconv.decode(response.data, 'utf-8');
|
||||||
|
const $ = cheerio.load(responseHtml);
|
||||||
|
|
||||||
|
const other = {};
|
||||||
|
const ela$ = $('#body > div > table:nth-child(2) > tbody > tr:nth-child(1) > td.post_td > div.attachlist > table > tbody > tr:nth-child(3) > td:nth-child(1) > a');
|
||||||
|
const ela$1 = $('#body > div > table:nth-child(2) > tbody > tr:nth-child(1) > td.post_td > div > div.attachlist > table > tbody > tr:nth-child(3) > td:nth-child(1) > a');
|
||||||
|
const content$ = $('.bg1.border.post');
|
||||||
|
const downloadPrefix = type === 'base' ? 'torrent下载链接:<br/><br/>' + maps[type] : 'torrent下载链接:<br/><br/>';
|
||||||
|
const downloada = type === 'base' ? ela$.attr('href') : ela$1.attr('href');
|
||||||
|
const downloadURL = downloada === undefined ? '无下载链接' : downloada.replace('dialog', 'download').toString();
|
||||||
|
const content = content$.html().toString();
|
||||||
|
other.des = downloadPrefix + downloadURL + '<br/><br/>' + '内容简介:<br/>' + content;
|
||||||
|
other.pubDate = type === 'base' ? new Date($('.bg2.border b:nth-child(2)').html()).toUTCString() : new Date().toUTCString();
|
||||||
|
ctx.cache.set(link, JSON.stringify(other));
|
||||||
|
return other;
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = async (ctx) => {
|
||||||
|
const type = ctx.params.type || 'base';
|
||||||
|
const response = await got({
|
||||||
|
method: 'get',
|
||||||
|
url: maps[type],
|
||||||
|
});
|
||||||
|
const htmldata = response.data;
|
||||||
|
const $ = cheerio.load(htmldata);
|
||||||
|
const list = $('.subject_link.thread-new').slice(0, 10);
|
||||||
|
|
||||||
|
const base_item = list
|
||||||
|
.map((_, e) => ({
|
||||||
|
title: type === 'base' ? e.attribs.title : $(e).html(),
|
||||||
|
link: type === 'base' ? maps[type] + e.attribs.href : e.attribs.href,
|
||||||
|
}))
|
||||||
|
.get()
|
||||||
|
.reverse();
|
||||||
|
|
||||||
|
const items = await Promise.all(
|
||||||
|
base_item.map(async (item) => {
|
||||||
|
const other = await load(item.link, type, ctx);
|
||||||
|
return {
|
||||||
|
enclosure_url: String(item.link),
|
||||||
|
enclosure_type: 'application/x-bittorrent',
|
||||||
|
title: item.title,
|
||||||
|
description: other.des,
|
||||||
|
pubDate: other.pubDate,
|
||||||
|
link: item.link,
|
||||||
|
};
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
const data = {
|
||||||
|
title: 'BT之家',
|
||||||
|
link: maps[type],
|
||||||
|
description: 'BT之家RSS',
|
||||||
|
item: items,
|
||||||
|
};
|
||||||
|
|
||||||
|
ctx.state.data = data;
|
||||||
|
};
|
||||||
53
lib/routes/universities/zucc/cssearch/index.js
Normal file
53
lib/routes/universities/zucc/cssearch/index.js
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
const got = require('@/utils/got');
|
||||||
|
const cheerio = require('cheerio');
|
||||||
|
|
||||||
|
const baseUrl = 'http://jsxy.zucc.edu.cn/';
|
||||||
|
const vpnUrl = 'http://jsxy.webvpn.zucc.edu.cn/';
|
||||||
|
const maps = {
|
||||||
|
search: '/module/sitesearch/index.jsp?keyword=vc_title&columnid=0&webid=2&modalunitid=13014',
|
||||||
|
};
|
||||||
|
|
||||||
|
function convert(raw) {
|
||||||
|
return unescape(raw.replace(/&#x/g, '%u').replace(/;/g, ''));
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = async (ctx) => {
|
||||||
|
const keyVal = ctx.params.key || encodeURIComponent('白卡');
|
||||||
|
const pageNum = 1;
|
||||||
|
const vpnBool = Number.parseInt(ctx.params.webVpn) || 0;
|
||||||
|
const response = await got({
|
||||||
|
method: 'get',
|
||||||
|
url: baseUrl + maps.search.concat('&keyvalue=', encodeURIComponent(keyVal), '&currpage=', pageNum.toString()),
|
||||||
|
});
|
||||||
|
|
||||||
|
const data = response.data;
|
||||||
|
const $ = cheerio.load(data);
|
||||||
|
const resItem = [];
|
||||||
|
$('a').each((index, el) => {
|
||||||
|
if ($(el).attr('target') === '_blank') {
|
||||||
|
const item = {};
|
||||||
|
item.title = convert($(el).html());
|
||||||
|
item.link =
|
||||||
|
vpnBool === 0
|
||||||
|
? $(el).attr('href')
|
||||||
|
: vpnUrl +
|
||||||
|
$(el)
|
||||||
|
.attr('href')
|
||||||
|
.slice(24);
|
||||||
|
const dateList = $(el)
|
||||||
|
.attr('href')
|
||||||
|
.match(/\/\d+/g)
|
||||||
|
.map((ele) => ele.toString().replace('/', ''));
|
||||||
|
item.pubDate = new Date(dateList.join('-')).toUTCString();
|
||||||
|
item.description = '<br/>' + $(el).attr('title') + '<br/>部分全文内容需使用校园网或VPN获取';
|
||||||
|
item.guid = convert($(el).html());
|
||||||
|
resItem.push(item);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
ctx.state.data = {
|
||||||
|
title: '浙江大学城市学院计算分院全站搜索:' + keyVal,
|
||||||
|
link: vpnBool === 0 ? baseUrl : vpnUrl,
|
||||||
|
item: resItem,
|
||||||
|
};
|
||||||
|
};
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
const got = require('@/utils/got');
|
const got = require('@/utils/got');
|
||||||
const cheerio = require('cheerio');
|
const cheerio = require('cheerio');
|
||||||
|
const iconv = require('iconv-lite');
|
||||||
|
|
||||||
const baseUrl = 'http://www.zucc.edu.cn';
|
const baseUrl = 'http://www.zucc.edu.cn';
|
||||||
const maps = {
|
const maps = {
|
||||||
@@ -21,7 +22,6 @@ module.exports = async (ctx) => {
|
|||||||
const reg = new RegExp(match, 'g');
|
const reg = new RegExp(match, 'g');
|
||||||
const res = xmlGet.match(reg);
|
const res = xmlGet.match(reg);
|
||||||
|
|
||||||
// eslint-disable-next-line no-unused-vars
|
|
||||||
const chapterItem = res.map((elem) => ({
|
const chapterItem = res.map((elem) => ({
|
||||||
link:
|
link:
|
||||||
baseUrl +
|
baseUrl +
|
||||||
@@ -38,10 +38,42 @@ module.exports = async (ctx) => {
|
|||||||
.toString()
|
.toString()
|
||||||
.slice(6, -7),
|
.slice(6, -7),
|
||||||
}));
|
}));
|
||||||
|
const chapterItemLatest = chapterItem.slice(0, 10).reverse();
|
||||||
|
|
||||||
|
const items = await Promise.all(
|
||||||
|
chapterItemLatest.map(async (item) => {
|
||||||
|
const cache = await ctx.cache.get(item.link);
|
||||||
|
if (cache) {
|
||||||
|
return Promise.resolve(JSON.parse(cache));
|
||||||
|
}
|
||||||
|
|
||||||
|
const response = await got({
|
||||||
|
method: 'get',
|
||||||
|
url: item.link,
|
||||||
|
responseType: 'buffer',
|
||||||
|
});
|
||||||
|
|
||||||
|
const responseHtml = iconv.decode(response.data, 'utf-8');
|
||||||
|
const $ = cheerio.load(responseHtml);
|
||||||
|
let description = '';
|
||||||
|
$('div#zoom').each((index, ele) => {
|
||||||
|
description = $(ele).html();
|
||||||
|
description += '\n';
|
||||||
|
});
|
||||||
|
|
||||||
|
const single = {
|
||||||
|
title: item.title,
|
||||||
|
description,
|
||||||
|
link: item.link,
|
||||||
|
};
|
||||||
|
ctx.cache.set(item.link, JSON.stringify(single));
|
||||||
|
return Promise.resolve(single);
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
ctx.state.data = {
|
ctx.state.data = {
|
||||||
title: '浙江大学城市学院新闻报道',
|
title: '浙江大学城市学院新闻报道',
|
||||||
link: baseUrl,
|
link: baseUrl,
|
||||||
item: chapterItem,
|
item: items,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user