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 #118 from DIYgod/master
[pull] master from diygod:master
- Loading branch information
Showing
21 changed files
with
296 additions
and
57 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
const got = require('@/utils/got'); | ||
const getRssItem = require('./utils'); | ||
|
||
const rootApiUrl = 'https://www.lifeweek.com.cn/api/userWebFollow/getFollowTagContentList?type=3&sort=2&tagId'; | ||
const rootUrl = 'https://www.lifeweek.com.cn/column'; | ||
const articleRootUrl = 'https://www.lifeweek.com.cn/article'; | ||
|
||
module.exports = async (ctx) => { | ||
const channel = ctx.params.id; | ||
const url = `${rootApiUrl}=${channel}`; | ||
const { data } = await got(url); | ||
const result = data.model.articleResponseList; | ||
const items = await Promise.all( | ||
result.map((item) => { | ||
const articleLink = `${articleRootUrl}/${item.id}`; | ||
return ctx.cache.tryGet(articleLink, () => getRssItem(item, articleLink)); | ||
}) | ||
); | ||
|
||
ctx.state.data = { | ||
title: data.model.tagName, | ||
link: `${rootUrl}/${channel}`, | ||
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,4 @@ | ||
module.exports = { | ||
'/channel/:channel': ['changren-wcr'], | ||
'/tag/:tag': ['changren-wcr'], | ||
}; |
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,19 @@ | ||
module.exports = { | ||
'lifeweek.com.cn': { | ||
_name: '三联生活周刊', | ||
'.': [ | ||
{ | ||
title: '栏目', | ||
docs: 'https://docs.rsshub.app/routes/traditional-media#san-lian-sheng-huo-zhou-kan', | ||
source: ['/column/:channel'], | ||
target: '/lifeweek/channel/:channel', | ||
}, | ||
{ | ||
title: '标签', | ||
docs: 'https://docs.rsshub.app/routes/traditional-media#san-lian-sheng-huo-zhou-kan', | ||
source: ['/articleList/:tag'], | ||
target: '/lifeweek/tag/:tag', | ||
}, | ||
], | ||
}, | ||
}; |
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,4 @@ | ||
module.exports = function (router) { | ||
router.get('/channel/:id', require('./channel')); | ||
router.get('/tag/:id', require('./tag')); | ||
}; |
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,24 @@ | ||
const got = require('@/utils/got'); | ||
const getRssItem = require('./utils'); | ||
const rootApiUrl = 'https://www.lifeweek.com.cn/api/userWebFollow/getFollowTagContentList?type=4&sort=2&tagId'; | ||
const rootUrl = 'https://www.lifeweek.com.cn/articleList'; | ||
const articleRootUrl = 'https://www.lifeweek.com.cn/article'; | ||
|
||
module.exports = async (ctx) => { | ||
const tag = ctx.params.id; | ||
const url = `${rootApiUrl}=${tag}`; | ||
const { data } = await got(url); | ||
const result = data.model.articleResponseList; | ||
const items = await Promise.all( | ||
result.map((item) => { | ||
const articleLink = `${articleRootUrl}/${item.id}`; | ||
return ctx.cache.tryGet(articleLink, () => getRssItem(item, articleLink)); | ||
}) | ||
); | ||
|
||
ctx.state.data = { | ||
title: data.model.tagName, | ||
link: `${rootUrl}/${tag}`, | ||
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,18 @@ | ||
const got = require('@/utils/got'); | ||
const timezone = require('@/utils/timezone'); | ||
const { parseDate } = require('@/utils/parse-date'); | ||
const articleApiRootUrl = 'https://www.lifeweek.com.cn/api/article'; | ||
|
||
async function getRssItem(item, articleLink) { | ||
const articleApiLink = `${articleApiRootUrl}/${item.id}`; | ||
const { data } = await got(articleApiLink); | ||
const time = timezone(parseDate(item.pubTime), +8); | ||
return { | ||
title: item.title, | ||
description: data.model.content, | ||
link: articleLink, | ||
pubDate: time, | ||
}; | ||
} | ||
|
||
module.exports = getRssItem; |
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 = { | ||
'/': ['artefaritaKuniklo'], | ||
}; |
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,44 @@ | ||
const got = require('@/utils/got'); | ||
const cheerio = require('cheerio'); | ||
const { parseDate } = require('@/utils/parse-date'); | ||
const timezone = require('@/utils/timezone'); | ||
|
||
module.exports = async (ctx) => { | ||
const baseUrl = 'https://medieval-china.club'; | ||
const { data: response } = await got(baseUrl); | ||
const $ = cheerio.load(response); | ||
const posts = JSON.parse( | ||
$('script:contains("window.localPosts")') | ||
.text() | ||
.match(/window\.localPosts = JSON\.parse\('(.*)'\);/)[1] | ||
) | ||
.slice(0, ctx.query.limit ? parseInt(ctx.query.limit) : 10) | ||
.map((item) => ({ | ||
title: item.title, | ||
link: `${baseUrl}${item.path}`, | ||
pubDate: timezone(parseDate(item.date), +8), | ||
})); | ||
const items = await Promise.all( | ||
posts.map((item) => | ||
ctx.cache.tryGet(item.link, async () => { | ||
const { data: response } = await got(item.link); | ||
const $ = cheerio.load(response); | ||
const imgSrc = $('img').attr('data-original'); | ||
$('img').attr('src', `${baseUrl}${imgSrc}`); | ||
$('.head-mask').remove(); | ||
$('div.lover-box').remove(); | ||
item.description = $('article').first().html(); | ||
return item; | ||
}) | ||
) | ||
); | ||
|
||
ctx.state.data = { | ||
title: '中国的中古', | ||
link: baseUrl, | ||
item: items, | ||
image: 'https://medieval-china.club/images/icons/favicon-144x144.png', | ||
description: | ||
'世界那么大,你无法去到每一个地方,感受每一处风景;时间那么长,那些逝去的人你也终将无法与之谋面。而通过古人之文字,今人之分享,你可以领略以前风光之奇绝瑰玮,感受逝人之人情冷暖。中古就是这么一个地方,大家来自全球各地,不同时区,不同性别,不同身份,不同职业,但是大家都被中古的绚烂华章聚集在一起,哀其所哀,乐其所乐。这是一个虚拟的世界,但是我们仿佛跨越千里而来,谈一场绝世爱恋,今夕何夕!仅以此网站献给中古club的每一位成员,契阔谈宴,西园不芜!', | ||
}; | ||
}; |
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 = { | ||
'medieval-china.club': { | ||
_name: '中国的中古', | ||
'.': [ | ||
{ | ||
title: '首页', | ||
docs: 'https://docs.rsshub.app/routes/reading#zhong-guo-de-zhong-shou-ye', | ||
source: '/', | ||
target: '/medieval-china', | ||
}, | ||
], | ||
}, | ||
}; |
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('/', require('./post')); | ||
}; |
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
module.exports = { | ||
'/3days/:location': ['Rein-Ou'], | ||
'/3days/:location': ['Rein-Ou', 'la3rence'], | ||
'/now/:location': ['Rein-Ou'], | ||
}; |
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 |
---|---|---|
@@ -1,44 +1,53 @@ | ||
const got = require('@/utils/got'); | ||
const cheerio = require('cheerio'); | ||
const timezone = require('@/utils/timezone'); | ||
const { parseDate } = require('@/utils/parse-date'); | ||
|
||
module.exports = async (ctx) => { | ||
const baseURL = 'http://www.shmeea.edu.cn'; | ||
const rootUrl = baseURL + '/page/08000/index.html'; | ||
const response = await got({ | ||
method: 'get', | ||
url: rootUrl, | ||
}); | ||
const id = ctx.params.id ?? '08000'; | ||
const baseURL = 'https://www.shmeea.edu.cn'; | ||
const link = `${baseURL}/page/${id}/index.html`; | ||
|
||
const data = response.data; | ||
const response = await got(link); | ||
const $ = cheerio.load(response.data); | ||
|
||
const $ = cheerio.load(data); | ||
const title = `上海市教育考试院-${$('#main .pageh4-tit').text().trim()}`; | ||
|
||
const list = $('#main .pageList li'); | ||
const list = $('#main .pageList li') | ||
.toArray() | ||
.map((item) => { | ||
item = $(item); | ||
return { | ||
title: item.find('a').attr('title') || item.find('a').text(), | ||
link: new URL(item.find('a').attr('href'), baseURL).href, | ||
pubDate: parseDate(item.find('.listTime').text().trim(), 'YYYY-MM-DD'), | ||
}; | ||
}); | ||
|
||
const items = await Promise.all( | ||
list.map(async (i, item) => { | ||
item = $(item); | ||
const link = baseURL + item.find('a').attr('href'); | ||
const description = await ctx.cache.tryGet(link, async () => { | ||
const result = await got.get(link); | ||
list.map((item) => | ||
ctx.cache.tryGet(item.link, async () => { | ||
if (!item.link.endsWith('.html') || new URL(item.link).hostname !== new URL(baseURL).hostname) { | ||
return item; | ||
} | ||
|
||
const result = await got(item.link); | ||
const $ = cheerio.load(result.data); | ||
|
||
return $('#ivs_content').html(); | ||
}); | ||
return { | ||
title: item.find('a').text(), | ||
pubDate: new Date(item.find('.listTime').text()), | ||
link, | ||
description, | ||
}; | ||
}) | ||
const description = $('#ivs_content').html(); | ||
const pbTimeText = $('#ivs_title .PBtime').text().trim(); | ||
|
||
item.description = description; | ||
item.pubDate = pbTimeText ? timezone(parseDate(pbTimeText, 'YYYY-MM-DD HH:mm:ss'), +8) : item.pubDate; | ||
|
||
return item; | ||
}) | ||
) | ||
); | ||
|
||
ctx.state.data = { | ||
title: '上海市教育考试院', | ||
description: '消息速递', | ||
link: baseURL, | ||
title, | ||
link, | ||
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
module.exports = { | ||
'/': ['jialinghui'], | ||
'/:id?': ['jialinghui', 'Misaka13514'], | ||
'/self-study': ['h2ws'], | ||
}; |
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
module.exports = function (router) { | ||
router.get('/', require('./index')); | ||
router.get('/self-study', require('./self-study')); | ||
router.get('/:id?', require('./index')); | ||
}; |
Oops, something went wrong.