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 #119 from DIYgod/master
[pull] master from diygod:master
- Loading branch information
Showing
10 changed files
with
100 additions
and
59 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 was deleted.
Oops, something went wrong.
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,3 @@ | ||
module.exports = { | ||
'/news': ['SayaSS'], | ||
}; |
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,54 @@ | ||
const got = require('@/utils/got'); | ||
const cheerio = require('cheerio'); | ||
|
||
module.exports = async (ctx) => { | ||
const parseContent = (htmlString) => { | ||
const $ = cheerio.load(htmlString); | ||
|
||
$('.contents-body h3').remove(); | ||
const time = $('.meta-info .time').text().trim(); | ||
$('.meta-info').remove(); | ||
const content = $('.contents-body'); | ||
|
||
return { | ||
description: content.html(), | ||
pubDate: new Date(time), | ||
}; | ||
}; | ||
|
||
const response = await got({ | ||
method: 'get', | ||
url: 'https://priconne-redive.jp/news/', | ||
}); | ||
const data = response.data; | ||
const $ = cheerio.load(data); | ||
const list = $('.article_box'); | ||
|
||
const out = await Promise.all( | ||
list.map((index, item) => { | ||
item = $(item); | ||
const link = item.find('a').first().attr('href'); | ||
return ctx.cache.tryGet(link, async () => { | ||
const rssitem = { | ||
title: item.find('h4').text(), | ||
link, | ||
}; | ||
|
||
const response = await got(link); | ||
const result = parseContent(response.data); | ||
|
||
rssitem.description = result.description; | ||
rssitem.pubDate = result.pubDate; | ||
|
||
return rssitem; | ||
}); | ||
}) | ||
); | ||
|
||
ctx.state.data = { | ||
title: '公主链接日服-新闻', | ||
link: 'https://priconne-redive.jp/news/', | ||
language: 'ja', | ||
item: out, | ||
}; | ||
}; |
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 = { | ||
'priconne-redive.jp': { | ||
_name: 'プリンセスコネクト!Re:Dive', | ||
'.': [ | ||
{ | ||
title: 'News', | ||
docs: 'https://docs.rsshub.app/routes/game#princess-connect-re-dive-%E3%83%97%E3%83%AA%E3%83%B3%E3%82%BB%E3%82%B9%E3%82%B3%E3%83%8D%E3%82%AF%E3%83%88%EF%BC%81re-dive', | ||
source: ['/news'], | ||
target: '/priconne-redive/news', | ||
}, | ||
], | ||
}, | ||
}; |
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('/news', require('./news')); | ||
}; |
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