-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5b55d58
commit 3af4712
Showing
14 changed files
with
422 additions
and
375 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,27 @@ | ||
using System.Net.Http; | ||
using System.Threading.Tasks; | ||
using Danmaku.Controllers.Base; | ||
using Danmaku.Model; | ||
using Danmaku.Utils.Dao; | ||
using Microsoft.AspNetCore.Mvc; | ||
|
||
namespace Danmaku.Controllers.ArtPlayer.V1 | ||
{ | ||
[Route("api/artplayer/v1")] | ||
[ApiController] | ||
public class ArtPlayerController : DanmakuDaoBaseApiController | ||
{ | ||
private readonly IHttpClientFactory _httpClientFactory; | ||
|
||
public ArtPlayerController(IDanmakuDao danmakuDao, IHttpClientFactory httpClientFactory) : base(danmakuDao) | ||
{ | ||
_httpClientFactory = httpClientFactory; | ||
} | ||
|
||
[HttpGet] | ||
public async Task<string> Get(string id) | ||
{ | ||
return string.IsNullOrEmpty(id) ? null : new BilibiliDanmakuData(await Dao.DanmakuQuery(id)).ToXml(); | ||
} | ||
} | ||
} |
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,43 @@ | ||
using System.Threading.Tasks; | ||
using Danmaku.Model; | ||
using Danmaku.Utils.BiliBili; | ||
using Microsoft.AspNetCore.Mvc; | ||
|
||
namespace Danmaku.Controllers.ArtPlayer.V1 | ||
{ | ||
[Route("api/artplayer/v1")] | ||
[ApiController] | ||
public class BiliBiliController : ControllerBase | ||
{ | ||
private readonly IBiliBiliHelp _biliBili; | ||
|
||
public BiliBiliController(IBiliBiliHelp biliBiliHelp) | ||
{ | ||
_biliBili = biliBiliHelp; | ||
} | ||
|
||
// GET: api/dplayer/v3/bilibili | ||
[HttpGet("bilibili")] | ||
public async Task<string> Get() | ||
{ | ||
var request = Request.Query; | ||
|
||
string[] date = request["date"]; | ||
var cid = request["cid"].ToString(); | ||
if (string.IsNullOrEmpty(cid)) | ||
{ | ||
var aid = request["aid"]; | ||
if (string.IsNullOrEmpty(aid)) return new DanmakuWebResult(1); | ||
string p = request["p"]; | ||
p = string.IsNullOrEmpty(p) ? "1" : p; | ||
if (!int.TryParse(p, out var page)) return new DanmakuWebResult(1); | ||
cid = (await _biliBili.GetCid(aid, page)).ToString(); | ||
} | ||
|
||
return string.IsNullOrWhiteSpace(cid) | ||
? null | ||
: await _biliBili.GetBiDanmakuRaw(cid); | ||
|
||
} | ||
} | ||
} |
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
Oops, something went wrong.