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.
* 大连大学 * Format code * Format code * Add DLU router * Bangumi topic
- Loading branch information
1 parent
0cf6dbf
commit 4ba7c67
Showing
3 changed files
with
30 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
const axios = require('../../../utils/axios'); | ||
const cheerio = require('cheerio'); | ||
const DateTime = require('luxon').DateTime; | ||
const resolve_url = require('url').resolve; | ||
|
||
const base_url = 'https://bgm.tv/'; | ||
|
||
module.exports = async (ctx) => { | ||
const groupID = ctx.params.id; | ||
const link = 'https://bgm.tv/group/' + groupID + '/forum'; | ||
const html = (await axios.get(link)).data; | ||
const $ = cheerio.load(html); | ||
const title = 'Bangumi - ' + $('.SecondaryNavTitle').text(); | ||
|
||
ctx.state.data = { | ||
title: `${title}`, | ||
link: link, | ||
item: $('.topic_list .topic') | ||
.map((_, elem) => ({ | ||
link: resolve_url(base_url, $('.subject a', elem).attr('href')), | ||
title: $('.subject a', elem).attr('title'), | ||
pubDate: DateTime.fromFormat($('.time', elem).text(), 'yyyy-L-dd'), | ||
description: 'Author: ' + $('.author a', elem).text() + '<br>' + 'Replay: ' + $('.posts', elem).text(), | ||
})) | ||
.get(), | ||
}; | ||
}; |