Files
danmaku/views/danmaku.ejs
2024-01-18 23:39:03 +08:00

144 lines
5.7 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<% var title="主流视频网站弹幕解析接口"%>
<%- include('utils/header', {title}); %>
<body>
<div class="container">
<div class="row text-center">
<div class="page-header">
<h1>
主流视频网站弹幕文件解析接口
</h1>
</div>
</div>
<div class="row">
<div class="col-sm-8">
<p>
这是一个弹幕文件解析接口输入你要解析的视频地址即可获得B站弹幕形式的XML文件。<br/>
通过使用<a href="https:///www.dandanplay.com/">弹弹Play播放器</a>
或者<a href='https://tiansh.github.io/us-danmaku/bilibili/'>bilibili ASS 弹幕在线转换项目</a>
转换为普通字幕文件,即可在本地播放器中播放。
</p>
<p>
使用方法在当前页面添加一个查询字符串url<br/>
目前支持芒果TV腾讯视频优酷视频爱奇艺视频哔哩哔哩。<br/>
注意:目前只支持单个视频的解析,不支持专辑的解析。<br/>
赞助一下服务器费用吧!<a href="https://blog.home999.cc/about/#%E6%89%93%E8%B5%8F">打赏链接</a><br/>
遇到什么问题,或有任何意见可以在<a href="https://github.com/lyz05/danmaku/issues">Issue</a>中提出<br/>
<strong>温馨提示点击提交按钮耐心等待就好切勿疯狂刷新。在线爬取平均需要5s左右的时间</strong><br/>
</p>
<p>
<!-- 会对弹幕文本进行去重去除包含xml标签的非法弹幕文本 -->
例子:<br/>
<% urls.forEach(function(url) { %>
<%= path %>?url=<%= url %><br/>
<% }); %>
</p>
</div>
<div class="col-sm-4">
</div>
</div>
<div class="row">
<p>在下方直接输入视频网址,点击提交按钮也可解析。</p>
<form class="form-horizontal">
<div class="form-group">
<label class="col-sm-1 control-label">视频网址</label>
<div class="col-sm-5">
<!--suppress HtmlFormInputWithoutLabel -->
<input type="text" class="form-control" placeholder="URL" name="url">
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-1 col-sm-5">
<div class="checkbox">
<label>
<input type="checkbox" name="download" checked='checked'> 强制下载
</label>
</div>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-1 col-sm-5">
<button type="submit" class="btn btn-primary">提交</button>
</div>
</div>
</form>
</div>
<hr/>
<footer class="footer">
<div class="row">
Powered by <a href="https://fly.io/"><strong>Fly.io</strong> </a>
<span class="post-meta-divider">|</span>
Reference blog:
<!-- <a href="https://lxmymjr.github.io/contents/%E4%B8%BB%E6%B5%81%E8%A7%86%E9%A2%91%E7%BD%91%E7%AB%99%E5%BC%B9%E5%B9%95%E4%B8%8B%E8%BD%BD">主流视频网站弹幕下载</a>-->
<a href="https://blog.home999.cc/2020/%E5%9F%BA%E4%BA%8E%E9%98%BF%E9%87%8C%E4%BA%91%E5%87%BD%E6%95%B0%E5%AE%9E%E7%8E%B0%E5%BC%B9%E5%B9%95%E6%96%87%E4%BB%B6%E8%A7%A3%E6%9E%90%E6%8E%A5%E5%8F%A3">
<strong>主流视频网站弹幕下载</strong>
</a>
<span class="post-meta-divider">|</span>
Source Code:
<a href="https://github.com/lyz05/danmaku"><strong>开源代码</strong></a>
</div>
<div class="row">
今日解析量:<span id="today_visited"></span><span class="post-meta-divider"> | </span>
昨日解析量:<span id="lastday_visited"></span><span class="post-meta-divider"> | </span>
当月解析量:<span id="month_visited"></span>
</div>
</footer>
</div>
</body>
<script>
AV.init({
appId: "DBvUNEk87tttf0zxelzVRfuW-9Nh9j0Va",
appKey: "CnqCkxWUFTmxwzCqu1alwFEm",
serverURL: "https://dbvunek8.lc-cn-n1-shared.com"
});
function currentDay() {
const date = new Date(), y = date.getFullYear(), m = date.getMonth();
const start = new Date(date.setHours(0, 0, 0, 0));
const end = new Date(date.setHours(23, 59, 59, 999));
return [start, end, y, m+1];
}
function lastDay() {
const currentday = currentDay();
currentday[0].setDate(currentday[0].getDate() - 1);
currentday[1].setDate(currentday[1].getDate() - 1);
return currentday;
}
function currentMonth() {
const date = new Date(), y = date.getFullYear(), m = date.getMonth();
const firstDay = new Date(y, m, 1);
const lastDay = new Date(y, m + 1, 0);
return [firstDay, lastDay];
}
function danmakuQuery(date, ip) {
const className = `DanmakuAccess_${currentDay()[2]}_${currentDay()[3]}`;
const query = new AV.Query(className);
query.greaterThanOrEqualTo("createdAt", date[0]);
query.lessThan("createdAt", date[1]);
if (ip) query.equalTo("remoteIP", ip);
query.exists("url");
return query.count();
}
danmakuQuery(currentDay()).then((count)=>{
$('#today_visited').text(count);
});
danmakuQuery(lastDay()).then((count)=>{
$('#lastday_visited').text(count);
});
danmakuQuery(currentMonth()).then((count)=>{
$('#month_visited').text(count);
});
</script>
</html>