Skip to content

Commit

Permalink
更新api
Browse files Browse the repository at this point in the history
  • Loading branch information
MonoLogueChi committed May 19, 2022
1 parent ed5b095 commit 3c341f4
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 26 deletions.
15 changes: 1 addition & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,6 @@
这是一个解析 B 站弹幕,并转换为其他播放器弹幕格式的项目。

## API

约定:

- `id` bvid 或 aid
- `p` 分 P,默认为 1
- `format` 数据格式,json 或 xml

API:

- 原始弹幕 `/api/danmu/bilibili/v1/{id}/{p:int?}``/api/danmu/bilibili/v1/?id={id}&p={p}`
- 原始弹幕 原始数据 `/api/danmu/bilibili/v1/raw/{id}/{p:int?}``/api/danmu/bilibili/v1/raw/?id={id}&p={p}`
- Dplayer `/api/danmu/dplayer/v3/{id}/{p:int?}``/api/danmu/dplayer/v3/?id={id}&p={p}`
- ArtPlayer `/api/danmu/artplayer/v1/{id}/{p:int}.{format?}``/api/danmu/artplayer/v1.{format?}?id={id}&p={p}`
文档:[https://www.u2sb.com/pages/15f418/](https://www.u2sb.com/pages/15f418/)

本项目仅用于学习研究,参考项目:

Expand Down
1 change: 1 addition & 0 deletions src/Danmu.Bili.sln.DotSettings
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/UserDictionary/Words/=artplayer/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Bili/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Bilibili/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Danmu/@EntryIndexedValue">True</s:Boolean>
Expand Down
12 changes: 12 additions & 0 deletions src/Danmu.Bili/.config/dotnet-tools.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"version": 1,
"isRoot": true,
"tools": {
"dotnet-ef": {
"version": "6.0.5",
"commands": [
"dotnet-ef"
]
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
using Danmu.Bili.Utils.BiliBiliHelp;
using Microsoft.AspNetCore.Mvc;

namespace Danmu.Bili.Controllers.Api.Danmu.ArtPlayer.V1;
namespace Danmu.Bili.Controllers.Api.ArtPlayer.V1.BiliBili;

[Route("/api/danmu/artplayer/")]
[Route("/api/danmu/artplayer/v1/")]
[Route("/api/artplayer/bilibili/")]
[Route("/api/artplayer/v1/bilibili/")]
public class ArtPlayerDanmuController : BiliBiliBaseController
{
public ArtPlayerDanmuController(BiliBiliHelp bilibili) : base(bilibili)
Expand Down
7 changes: 4 additions & 3 deletions src/Danmu.Bili/Controllers/Api/BiliBili/V1/DanmuController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

namespace Danmu.Bili.Controllers.Api.BiliBili.V1;

[Route("/api/danmu/bilibili/")]
[Route("/api/danmu/bilibili/v1/")]
[Route("/api/bilibili/")]
[Route("/api/bilibili/v1/")]
public class DanmuController : BiliBiliBaseController
{
public DanmuController(BiliBiliHelp bilibili) : base(bilibili)
Expand All @@ -17,7 +17,8 @@ public DanmuController(BiliBiliHelp bilibili) : base(bilibili)

[HttpGet]
[HttpGet("{id}/{p:int?}")]
public async Task<WebResult<IEnumerable<DanmakuElem>?>> GetDanmu([FromQuery] BiliBiliQuery query, string? id, int p = 1)
public async Task<WebResult<IEnumerable<DanmakuElem>?>> GetDanmu([FromQuery] BiliBiliQuery query, string? id,
int p = 1)
{
var danmu = await Bilibili.GetDanmuAsync(query, id, p);
return new WebResult<IEnumerable<DanmakuElem>?>(danmu?.Elems);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
using Danmu.Bili.Utils.BiliBiliHelp;
using Microsoft.AspNetCore.Mvc;

namespace Danmu.Bili.Controllers.Api.Danmu.Dplayer.V3;
namespace Danmu.Bili.Controllers.Api.Dplayer.V3.BiliBili;

[Route("/api/danmu/dplayer/")]
[Route("/api/danmu/dplayer/v1/")]
[Route("/api/danmu/dplayer/v2/")]
[Route("/api/danmu/dplayer/v3/")]
[Route("/api/dplayer/bilibili/")]
[Route("/api/dplayer/v1/bilibili/")]
[Route("/api/dplayer/v2/bilibili/")]
[Route("/api/dplayer/v3/bilibili/")]
public class DplayerDanmuController : BiliBiliBaseController
{
public DplayerDanmuController(BiliBiliHelp bilibili) : base(bilibili)
Expand All @@ -18,7 +18,7 @@ public DplayerDanmuController(BiliBiliHelp bilibili) : base(bilibili)

[HttpGet]
[HttpGet("{id}/{p:int?}")]
public async Task<DplayerWebResult> Get([FromQuery] BiliBiliQuery query, string? id , int p = 1)
public async Task<DplayerWebResult> Get([FromQuery] BiliBiliQuery query, string? id, int p = 1)
{
var danmu = await Bilibili.GetDanmuAsync(query, id, p);
return new DplayerWebResult(danmu?.Elems);
Expand Down

0 comments on commit 3c341f4

Please sign in to comment.