forked from DIYgod/RSSHub
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #783 from DIYgod/master
[pull] master from diygod:master
- Loading branch information
Showing
28 changed files
with
411 additions
and
139 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
const got = require('@/utils/got'); | ||
const cheerio = require('cheerio'); | ||
const { parseDate } = require('@/utils/parse-date'); | ||
|
||
const baseUrl = 'https://www.bjsk.org.cn'; | ||
|
||
module.exports = async (ctx) => { | ||
const { path = 'newslist-1486-0-0' } = ctx.params; | ||
const link = `${baseUrl}/${path}.html`; | ||
const { data: response } = await got(link, { | ||
https: { | ||
rejectUnauthorized: false, | ||
}, | ||
}); | ||
const $ = cheerio.load(response); | ||
|
||
const list = $('.article-list a') | ||
.toArray() | ||
.map((item) => { | ||
item = $(item); | ||
return { | ||
title: item.attr('title'), | ||
link: `${baseUrl}${item.attr('href')}`, | ||
pubDate: parseDate(item.find('.time').text(), 'YYYY.MM.DD'), | ||
}; | ||
}); | ||
|
||
const items = await Promise.all( | ||
list.map((item) => | ||
ctx.cache.tryGet(item.link, async () => { | ||
const { data: response } = await got(item.link, { | ||
https: { | ||
rejectUnauthorized: false, | ||
}, | ||
}); | ||
const $ = cheerio.load(response); | ||
item.description = $('.article-main').html(); | ||
item.author = $('.info') | ||
.text() | ||
.match(/作者:(.*)\s+来源/)[1]; | ||
return item; | ||
}) | ||
) | ||
); | ||
|
||
ctx.state.data = { | ||
title: $('head title').text(), | ||
link, | ||
image: 'https://www.bjsk.org.cn/favicon.ico', | ||
item: items, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
'/:path?': ['TonyRL'], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
module.exports = { | ||
'bjsk.org.cn': { | ||
_name: '北京社科网', | ||
'.': [ | ||
{ | ||
title: '通用', | ||
docs: 'https://docs.rsshub.app/government.html#bei-jing-she-ke-wang', | ||
source: ['/*'], | ||
target: (_, url) => `/bjsk/${url.split('/')[3].replace('.html', '')}`, | ||
}, | ||
], | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = (router) => { | ||
router.get('/:path?', require('./index')); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
const cheerio = require('cheerio'); | ||
const got = require('@/utils/got'); | ||
const timezone = require('@/utils/timezone'); | ||
const { parseDate } = require('@/utils/parse-date'); | ||
|
||
module.exports = async (ctx) => { | ||
const baseUrl = 'http://www.bjwxdxh.org.cn'; | ||
const type = ctx.params.type; | ||
const link = type ? `${baseUrl}/news/class/?${type}.html` : `${baseUrl}/news/class/`; | ||
|
||
const response = await got({ | ||
method: 'get', | ||
url: link, | ||
}); | ||
|
||
const $ = cheerio.load(response.data); | ||
const list = $('div#newsquery > ul > li') | ||
.map((_, item) => { | ||
item = $(item); | ||
return { | ||
title: item.find('div.title > a').text(), | ||
link: new URL(item.find('div.title > a').attr('href'), baseUrl).href, | ||
// pubDate: parseDate(item.find('div.time').text(), 'YYYY-MM-DD'), | ||
}; | ||
}) | ||
.get(); | ||
|
||
await Promise.all( | ||
list.map((item) => | ||
ctx.cache.tryGet(item.link, async () => { | ||
const response = await got({ | ||
method: 'get', | ||
url: item.link, | ||
}); | ||
const content = cheerio.load(response.data); | ||
const info = content('div.info') | ||
.text() | ||
.match(/作者:(.*?)\s+发布于:(.*?\s+.*?)\s/); | ||
item.author = info[1]; | ||
item.pubDate = timezone(parseDate(info[2], 'YYYY-MM-DD HH:mm:ss'), +8); | ||
item.description = content('div#con').html().trim().replace(/\n/g, ''); | ||
return item; | ||
}) | ||
) | ||
); | ||
|
||
ctx.state.data = { | ||
title: $('title').text(), | ||
link, | ||
item: list, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
'/:type?': ['Misaka13514'], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
module.exports = { | ||
'bjwxdxh.org.cn': { | ||
_name: '北京无线电协会', | ||
www: [ | ||
{ | ||
title: '最新资讯', | ||
docs: 'https://docs.rsshub.app/government.html#bei-jing-wu-xian-dian-xie-hui', | ||
source: '/news/class/', | ||
target: (params, url) => (url.includes('?') ? `/bjwxdxh/${url.split('?')[1].split('.')[0]}` : '/bjwxdxh'), | ||
}, | ||
], | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = function (router) { | ||
router.get('/:type?', require('./index')); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
const got = require('@/utils/got'); | ||
const cheerio = require('cheerio'); | ||
const { parseDate } = require('@/utils/parse-date'); | ||
const timezone = require('@/utils/timezone'); | ||
const baseUrl = 'https://www.cast.org.cn'; | ||
|
||
module.exports = async (ctx) => { | ||
const { column = 457 } = ctx.params; | ||
const { limit = 10 } = ctx.query; | ||
const link = `${baseUrl}/col/col${column}/index.html`; | ||
const { data: response } = await got.post(`${baseUrl}/module/web/jpage/dataproxy.jsp`, { | ||
searchParams: { | ||
startrecord: 1, | ||
endrecord: limit, | ||
perpage: limit, | ||
}, | ||
form: { | ||
col: 1, | ||
appid: 1, | ||
webid: 1, | ||
path: '/', | ||
columnid: column, | ||
sourceContentType: 1, | ||
unitid: 335, | ||
webname: '中国科学技术协会', | ||
permissiontype: 0, | ||
}, | ||
}); | ||
|
||
const $ = cheerio.load(response, { | ||
xml: { | ||
xmlMode: true, | ||
}, | ||
}); | ||
|
||
const pageTitle = await ctx.cache.tryGet(link, async () => { | ||
const { data: response } = await got(link); | ||
const $ = cheerio.load(response); | ||
return $('head title').text(); | ||
}); | ||
|
||
const list = $('record') | ||
.toArray() | ||
.map((item) => { | ||
item = cheerio.load($(item).html(), null, false); | ||
const a = item('a').first(); | ||
return { | ||
title: a.text(), | ||
pubDate: parseDate(item('.list-data').text().trim(), 'DDYYYY/MM'), | ||
link: `${baseUrl}${a.attr('href')}`, | ||
}; | ||
}); | ||
|
||
const items = await Promise.all( | ||
list.map((item) => | ||
ctx.cache.tryGet(item.link, async () => { | ||
const { data: response } = await got(item.link); | ||
const $ = cheerio.load(response); | ||
|
||
item.description = $('#zoom').html(); | ||
item.pubDate = timezone(parseDate($('meta[name=PubDate]').attr('content'), 'YYYY-MM-DD HH:mm'), +8); | ||
|
||
return item; | ||
}) | ||
) | ||
); | ||
|
||
ctx.state.data = { | ||
title: pageTitle, | ||
link, | ||
image: 'https://www.cast.org.cn/favicon.ico', | ||
item: items, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
'/:column?': ['TonyRL'], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
module.exports = { | ||
'cast.org.cn': { | ||
_name: '中国科学技术协会', | ||
'.': [ | ||
{ | ||
title: '通用', | ||
docs: 'https://docs.rsshub.app/government.html#zhong-guo-ke-xue-ji-shu-xie-hui', | ||
source: ['/col/:column/index.html'], | ||
target: (params) => `/cast/${params.column.replace('col', '')}`, | ||
}, | ||
], | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = (router) => { | ||
router.get('/:column?', require('./index')); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
cd94a7a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
rsshub-master – ./
rsshub-master-auto-bot-ty.vercel.app
rsshub-master.vercel.app
rsshub-master-git-master-auto-bot-ty.vercel.app