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 #124 from DIYgod/master
[pull] master from diygod:master
- Loading branch information
Showing
9 changed files
with
58 additions
and
12 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import got from '@/utils/got'; | ||
const cache = require('./cache'); | ||
const utils = require('./utils'); | ||
import { parseDate } from '@/utils/parse-date'; | ||
|
||
module.exports = async (ctx) => { | ||
const uid = ctx.req.param('uid'); | ||
const disableEmbed = ctx.req.param('disableEmbed'); | ||
|
||
const name = await cache.getUsernameFromUID(ctx, uid); | ||
|
||
const response = await got({ | ||
url: `https://api.bilibili.com/x/space/like/video?vmid=${uid}`, | ||
headers: { | ||
Referer: `https://space.bilibili.com/${uid}/`, | ||
}, | ||
}); | ||
const { data, code, message } = response.data; | ||
if (code) { | ||
throw new Error(message ?? code); | ||
} | ||
|
||
ctx.set('data', { | ||
title: `${name} 的 bilibili 点赞视频`, | ||
link: `https://space.bilibili.com/${uid}`, | ||
description: `${name} 的 bilibili 点赞视频`, | ||
item: data.list.map((item) => ({ | ||
title: item.title, | ||
description: `${item.desc}${disableEmbed ? '' : `<br><br>${utils.iframe(item.aid)}`}<br><img src='${item.pic}'>`, | ||
pubDate: parseDate(item.pubdate * 1000), | ||
link: item.pubdate > utils.bvidTime && item.bvid ? `https://www.bilibili.com/video/${item.bvid}` : `https://www.bilibili.com/video/av${item.aid}`, | ||
author: item.owner.name, | ||
})), | ||
}); | ||
}; |
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export default (router) => { | ||
router.get('package/*', './package'); | ||
// https://github.com/dword-design/package-name-regex/blob/master/src/index.js | ||
router.get('package/:name{(@[a-z0-9-~][a-z0-9-._~]*\\/)?[a-z0-9-~][a-z0-9-._~]*}', './package'); | ||
}; |
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