import{_ as t,c as n,a as l,o as a}from"./app-Dgsdh8A6.js";const o={};function p(e,s){return a(),n("div",null,s[0]||(s[0]=[l(`<h1 id="xml弹幕" tabindex="-1"><a class="header-anchor" href="#xml弹幕"><span>xml弹幕</span></a></h1><p>实时弹幕池容量有限（根据视频类型500-8000条不等），占满后再发送会使实时弹幕池底部的弹幕压入历史弹幕池（类似于堆栈）</p><h2 id="获取实时弹幕1" tabindex="-1"><a class="header-anchor" href="#获取实时弹幕1"><span>获取实时弹幕1</span></a></h2><blockquote><p>https://api.bilibili.com/x/v1/dm/list.so</p></blockquote><p><em>请求方式：GET</em></p><p><strong>使用deflate压缩，注意解码</strong></p><p><strong>url参数：</strong></p><table><thead><tr><th>参数名</th><th>类型</th><th>内容</th><th>必要性</th><th>备注</th></tr></thead><tbody><tr><td>oid</td><td>num</td><td>视频cid</td><td>必要</td><td></td></tr></tbody></table><p><strong>示例：</strong></p><div class="language-shell line-numbers-mode" data-highlighter="shiki" data-ext="shell" style="background-color:#1E1E1E;color:#D4D4D4;"><pre class="shiki dark-plus vp-code"><code class="language-shell"><span class="line"><span style="color:#DCDCAA;">curl</span><span style="color:#569CD6;"> -G</span><span style="color:#CE9178;"> &#39;https://api.bilibili.com/x/v1/dm/list.so&#39;</span><span style="color:#D7BA7D;"> \\</span></span>
<span class="line"><span style="color:#D4D4D4;">--data-urlencode </span><span style="color:#CE9178;">&#39;oid=144541892&#39;</span><span style="color:#D7BA7D;"> \\</span></span>
<span class="line"><span style="color:#D4D4D4;">--compressed </span><span style="color:#569CD6;">-o</span><span style="color:#CE9178;"> &#39;danmaku.xml&#39;</span></span></code></pre><div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0;"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><h2 id="获取实时弹幕2" tabindex="-1"><a class="header-anchor" href="#获取实时弹幕2"><span>获取实时弹幕2</span></a></h2><blockquote><p>https://comment.bilibili.com/{cid}.xml</p></blockquote><p><em>请求方式：GET</em></p><p>效果与前者相同</p><p><strong>使用deflate压缩，注意解码</strong></p><p><strong>url路径：</strong></p><table><thead><tr><th>参数名</th><th>类型</th><th>内容</th><th>必要性</th><th>备注</th></tr></thead><tbody><tr><td>cid</td><td>num</td><td>视频cid</td><td>必要</td><td></td></tr></tbody></table><p><strong>示例：</strong></p><div class="language-shell line-numbers-mode" data-highlighter="shiki" data-ext="shell" style="background-color:#1E1E1E;color:#D4D4D4;"><pre class="shiki dark-plus vp-code"><code class="language-shell"><span class="line"><span style="color:#DCDCAA;">curl</span><span style="color:#CE9178;"> &#39;https://comment.bilibili.com/144541892.xml&#39;</span></span>
<span class="line"><span style="color:#DCDCAA;">--compressed</span><span style="color:#569CD6;"> -o</span><span style="color:#CE9178;"> &#39;danmaku.xml&#39;</span></span></code></pre><div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0;"><div class="line-number"></div><div class="line-number"></div></div></div><p><strong>xml回复：</strong></p><details><summary>查看响应示例：</summary><div class="language-xml line-numbers-mode" data-highlighter="shiki" data-ext="xml" style="background-color:#1E1E1E;color:#D4D4D4;"><pre class="shiki dark-plus vp-code"><code class="language-xml"><span class="line"><span style="color:#808080;">&lt;?</span><span style="color:#569CD6;">xml</span><span style="color:#9CDCFE;"> version</span><span style="color:#D4D4D4;">=</span><span style="color:#CE9178;">&quot;1.0&quot;</span><span style="color:#9CDCFE;"> encoding</span><span style="color:#D4D4D4;">=</span><span style="color:#CE9178;">&quot;UTF-8&quot;</span><span style="color:#808080;">?&gt;</span></span>
<span class="line"><span style="color:#808080;">&lt;</span><span style="color:#569CD6;">i</span><span style="color:#808080;">&gt;</span></span>
<span class="line"><span style="color:#808080;">    &lt;</span><span style="color:#569CD6;">chatserver</span><span style="color:#808080;">&gt;</span><span style="color:#D4D4D4;">chat.bilibili.com</span><span style="color:#808080;">&lt;/</span><span style="color:#569CD6;">chatserver</span><span style="color:#808080;">&gt;</span></span>
<span class="line"><span style="color:#808080;">    &lt;</span><span style="color:#569CD6;">chatid</span><span style="color:#808080;">&gt;</span><span style="color:#D4D4D4;">144541892</span><span style="color:#808080;">&lt;/</span><span style="color:#569CD6;">chatid</span><span style="color:#808080;">&gt;</span></span>
<span class="line"><span style="color:#808080;">    &lt;</span><span style="color:#569CD6;">mission</span><span style="color:#808080;">&gt;</span><span style="color:#D4D4D4;">0</span><span style="color:#808080;">&lt;/</span><span style="color:#569CD6;">mission</span><span style="color:#808080;">&gt;</span></span>
<span class="line"><span style="color:#808080;">    &lt;</span><span style="color:#569CD6;">maxlimit</span><span style="color:#808080;">&gt;</span><span style="color:#D4D4D4;">1500</span><span style="color:#808080;">&lt;/</span><span style="color:#569CD6;">maxlimit</span><span style="color:#808080;">&gt;</span></span>
<span class="line"><span style="color:#808080;">    &lt;</span><span style="color:#569CD6;">state</span><span style="color:#808080;">&gt;</span><span style="color:#D4D4D4;">0</span><span style="color:#808080;">&lt;/</span><span style="color:#569CD6;">state</span><span style="color:#808080;">&gt;</span></span>
<span class="line"><span style="color:#808080;">    &lt;</span><span style="color:#569CD6;">real_name</span><span style="color:#808080;">&gt;</span><span style="color:#D4D4D4;">0</span><span style="color:#808080;">&lt;/</span><span style="color:#569CD6;">real_name</span><span style="color:#808080;">&gt;</span></span>
<span class="line"><span style="color:#808080;">    &lt;</span><span style="color:#569CD6;">source</span><span style="color:#808080;">&gt;</span><span style="color:#D4D4D4;">e-r</span><span style="color:#808080;">&lt;/</span><span style="color:#569CD6;">source</span><span style="color:#808080;">&gt;</span></span>
<span class="line"><span style="color:#808080;">    &lt;</span><span style="color:#569CD6;">d</span><span style="color:#9CDCFE;"> p</span><span style="color:#D4D4D4;">=</span><span style="color:#CE9178;">&quot;490.19100,1,25,16777215,1584268892,0,a16fe0dd,29950852386521095&quot;</span><span style="color:#808080;">&gt;</span><span style="color:#D4D4D4;">从结尾回来看这里，更感动了！</span><span style="color:#808080;">&lt;/</span><span style="color:#569CD6;">d</span><span style="color:#808080;">&gt;</span></span>
<span class="line"><span style="color:#808080;">    &lt;</span><span style="color:#569CD6;">d</span><span style="color:#9CDCFE;"> p</span><span style="color:#D4D4D4;">=</span><span style="color:#CE9178;">&quot;18.77300,1,25,16777215,1584268920,0,4fe08d3,29950867226492933&quot;</span><span style="color:#808080;">&gt;</span><span style="color:#D4D4D4;">咦三体居然还有动画</span><span style="color:#808080;">&lt;/</span><span style="color:#569CD6;">d</span><span style="color:#808080;">&gt;</span></span>
<span class="line"><span style="color:#808080;">    &lt;</span><span style="color:#569CD6;">d</span><span style="color:#9CDCFE;"> p</span><span style="color:#D4D4D4;">=</span><span style="color:#CE9178;">&quot;52.88400,1,25,16777215,1584268954,0,4fe08d3,29950885214289927&quot;</span><span style="color:#808080;">&gt;</span><span style="color:#D4D4D4;">哈哈哈哈开心</span><span style="color:#808080;">&lt;/</span><span style="color:#569CD6;">d</span><span style="color:#808080;">&gt;</span></span>
<span class="line"><span style="color:#808080;">    &lt;</span><span style="color:#569CD6;">d</span><span style="color:#9CDCFE;"> p</span><span style="color:#D4D4D4;">=</span><span style="color:#CE9178;">&quot;25.51600,1,25,16777215,1584268957,0,e4b18b37,29950886612566021&quot;</span><span style="color:#808080;">&gt;</span><span style="color:#D4D4D4;">红岸么</span><span style="color:#808080;">&lt;/</span><span style="color:#569CD6;">d</span><span style="color:#808080;">&gt;</span></span>
<span class="line"><span style="color:#808080;">    &lt;</span><span style="color:#569CD6;">d</span><span style="color:#9CDCFE;"> p</span><span style="color:#D4D4D4;">=</span><span style="color:#CE9178;">&quot;144.45200,1,25,16777215,1584269076,0,e4b18b37,29950948716576775&quot;</span><span style="color:#808080;">&gt;</span><span style="color:#D4D4D4;">我就是想看我的世界里水滴长啥样</span><span style="color:#808080;">&lt;/</span><span style="color:#569CD6;">d</span><span style="color:#808080;">&gt;</span></span>
<span class="line"><span style="color:#808080;">    &lt;</span><span style="color:#569CD6;">d</span><span style="color:#9CDCFE;"> p</span><span style="color:#D4D4D4;">=</span><span style="color:#CE9178;">&quot;112.64100,1,25,16777215,1584269109,0,96606007,29950966302244871&quot;</span><span style="color:#808080;">&gt;</span><span style="color:#D4D4D4;">有手指？</span><span style="color:#808080;">&lt;/</span><span style="color:#569CD6;">d</span><span style="color:#808080;">&gt;</span></span>
<span class="line"><span style="color:#808080;">    &lt;</span><span style="color:#569CD6;">d</span><span style="color:#9CDCFE;"> p</span><span style="color:#D4D4D4;">=</span><span style="color:#CE9178;">&quot;222.84000,1,25,16777215,1584269154,0,e4b18b37,29950989809745923&quot;</span><span style="color:#808080;">&gt;</span><span style="color:#D4D4D4;">侦测到在途的聚变打击</span><span style="color:#808080;">&lt;/</span><span style="color:#569CD6;">d</span><span style="color:#808080;">&gt;</span></span>
<span class="line"><span style="color:#808080;">    &lt;</span><span style="color:#569CD6;">d</span><span style="color:#9CDCFE;"> p</span><span style="color:#D4D4D4;">=</span><span style="color:#CE9178;">&quot;284.77800,1,25,16777215,1584269216,0,e4b18b37,29951022237483011&quot;</span><span style="color:#808080;">&gt;</span><span style="color:#D4D4D4;">都是虫子</span><span style="color:#808080;">&lt;/</span><span style="color:#569CD6;">d</span><span style="color:#808080;">&gt;</span></span>
<span class="line"><span style="color:#808080;">    &lt;</span><span style="color:#569CD6;">d</span><span style="color:#9CDCFE;"> p</span><span style="color:#D4D4D4;">=</span><span style="color:#CE9178;">&quot;398.00500,1,25,16777215,1584269329,0,e4b18b37,29951081615196163&quot;</span><span style="color:#808080;">&gt;</span><span style="color:#D4D4D4;">ocean</span><span style="color:#808080;">&lt;/</span><span style="color:#569CD6;">d</span><span style="color:#808080;">&gt;</span></span>
<span class="line"><span style="color:#808080;">    &lt;</span><span style="color:#569CD6;">d</span><span style="color:#9CDCFE;"> p</span><span style="color:#D4D4D4;">=</span><span style="color:#CE9178;">&quot;432.17900,1,25,16777215,1584269363,0,e4b18b37,29951099571535943&quot;</span><span style="color:#808080;">&gt;</span><span style="color:#D4D4D4;">村民，哼~</span><span style="color:#808080;">&lt;/</span><span style="color:#569CD6;">d</span><span style="color:#808080;">&gt;</span></span>
<span class="line"><span style="color:#808080;">    &lt;</span><span style="color:#569CD6;">d</span><span style="color:#9CDCFE;"> p</span><span style="color:#D4D4D4;">=</span><span style="color:#CE9178;">&quot;467.41900,1,25,16777215,1584269399,0,e4b18b37,29951118364639237&quot;</span><span style="color:#808080;">&gt;</span><span style="color:#D4D4D4;">黄河之水天上来</span><span style="color:#808080;">&lt;/</span><span style="color:#569CD6;">d</span><span style="color:#808080;">&gt;</span></span>
<span class="line"><span style="color:#808080;">    &lt;</span><span style="color:#569CD6;">d</span><span style="color:#9CDCFE;"> p</span><span style="color:#D4D4D4;">=</span><span style="color:#CE9178;">&quot;6.71900,1,25,16777215,1584269422,0,70ba16f4,29951130398621699&quot;</span><span style="color:#808080;">&gt;</span><span style="color:#D4D4D4;">镇站之宝</span><span style="color:#808080;">&lt;/</span><span style="color:#569CD6;">d</span><span style="color:#808080;">&gt;</span></span>
<span class="line"><span style="color:#808080;">    &lt;</span><span style="color:#569CD6;">d</span><span style="color:#9CDCFE;"> p</span><span style="color:#D4D4D4;">=</span><span style="color:#CE9178;">&quot;313.08600,1,25,16777215,1584269425,0,e531c9dc,29951131798994947&quot;</span><span style="color:#808080;">&gt;</span><span style="color:#D4D4D4;">这水</span><span style="color:#808080;">&lt;/</span><span style="color:#569CD6;">d</span><span style="color:#808080;">&gt;</span></span>
<span class="line"><span style="color:#808080;">    &lt;</span><span style="color:#569CD6;">d</span><span style="color:#9CDCFE;"> p</span><span style="color:#D4D4D4;">=</span><span style="color:#CE9178;">&quot;587.87900,1,25,16777215,1584269519,0,e4b18b37,29951181142360071&quot;</span><span style="color:#808080;">&gt;</span><span style="color:#D4D4D4;">海的那边是什么</span><span style="color:#808080;">&lt;/</span><span style="color:#569CD6;">d</span><span style="color:#808080;">&gt;</span></span>
<span class="line"><span style="color:#808080;">    &lt;</span><span style="color:#569CD6;">d</span><span style="color:#9CDCFE;"> p</span><span style="color:#D4D4D4;">=</span><span style="color:#CE9178;">&quot;618.05000,1,25,16777215,1584269549,0,e4b18b37,29951196901933061&quot;</span><span style="color:#808080;">&gt;</span><span style="color:#D4D4D4;">折跃门准备完毕</span><span style="color:#808080;">&lt;/</span><span style="color:#569CD6;">d</span><span style="color:#808080;">&gt;</span></span>
<span class="line"><span style="color:#D4D4D4;">    …………</span></span>
<span class="line"><span style="color:#808080;">&lt;</span><span style="color:#569CD6;">i</span><span style="color:#808080;">&gt;</span></span></code></pre><div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0;"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div></details><h2 id="弹幕格式" tabindex="-1"><a class="header-anchor" href="#弹幕格式"><span>弹幕格式</span></a></h2><h3 id="xml格式结构" tabindex="-1"><a class="header-anchor" href="#xml格式结构"><span>xml格式结构</span></a></h3><ul><li><p>标签 i</p><ul><li><p>标签 chatserver：chat.bilibili.com</p></li><li><p>标签 chatid：视频cid</p></li><li><p>标签 mission：0</p></li><li><p>标签 maxlimit：实时弹幕池最大容量</p></li><li><p>标签 state：弹幕状态（0：正常 1：弹幕已关闭）</p></li><li><p>标签 real_name：0</p></li><li><p>标签 source：e-r</p></li><li><p>标签 d （带有属性 p）：弹幕内容</p></li></ul></li></ul><h3 id="属性-p" tabindex="-1"><a class="header-anchor" href="#属性-p"><span>属性 p</span></a></h3><p>字符串内每项用逗号<code>,</code>分隔</p><table><thead><tr><th>项</th><th>含义</th><th>类型</th><th>备注</th></tr></thead><tbody><tr><td>0</td><td>视频内弹幕出现时间</td><td>float</td><td>秒</td></tr><tr><td>1</td><td>弹幕类型</td><td>int32</td><td>1 2 3：普通弹幕<br>4：底部弹幕<br>5：顶部弹幕<br>6：逆向弹幕<br>7：高级弹幕<br>8：代码弹幕<br>9：BAS弹幕（<code>pool</code>必须为2）</td></tr><tr><td>2</td><td>弹幕字号</td><td>int32</td><td>18：小<br>25：标准<br>36：大</td></tr><tr><td>3</td><td>弹幕颜色</td><td>int32</td><td>十进制RGB888值</td></tr><tr><td>4</td><td>弹幕发送时间</td><td>int32</td><td>时间戳</td></tr><tr><td>5</td><td>弹幕池类型</td><td>int32</td><td>0: 普通池<br>1: 字幕池<br>2: 特殊池 (代码/BAS弹幕)<br>3: 互动池?</td></tr><tr><td>6</td><td>发送者mid的HASH</td><td>string</td><td>用于屏蔽用户和查看用户发送的所有弹幕 也可反查用户id</td></tr><tr><td>7</td><td>弹幕dmid</td><td>int64</td><td>唯一 可用于操作参数</td></tr><tr><td>8</td><td>弹幕的屏蔽等级</td><td>int32</td><td>0-10，低于用户设定等级的弹幕将被屏蔽<br>（新增，下方样例未包含）</td></tr></tbody></table><div class="language-xml line-numbers-mode" data-highlighter="shiki" data-ext="xml" style="background-color:#1E1E1E;color:#D4D4D4;"><pre class="shiki dark-plus vp-code"><code class="language-xml"><span class="line"><span style="color:#808080;">&lt;</span><span style="color:#569CD6;">d</span><span style="color:#9CDCFE;"> p</span><span style="color:#D4D4D4;">=</span><span style="color:#CE9178;">&quot;490.19100,1,25,16777215,1584268892,0,a16fe0dd,29950852386521095&quot;</span><span style="color:#808080;">&gt;</span><span style="color:#D4D4D4;">从结尾回来看这里，更感动了！</span><span style="color:#808080;">&lt;/</span><span style="color:#569CD6;">d</span><span style="color:#808080;">&gt;</span></span></code></pre><div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0;"><div class="line-number"></div></div></div><p>弹幕内容为：“从结尾回来看这里，更感动了！”</p><p>参数为：视频内出现的时间是490.19100秒，类型是普通弹幕，字号为标准，颜色为白色（#FFFFFF），发送时间是2020/3/15 18:41:32.........</p><h3 id="web版标准颜色" tabindex="-1"><a class="header-anchor" href="#web版标准颜色"><span>web版标准颜色</span></a></h3><p>弹幕的颜色属性使用<strong>十进制RGB888</strong>值</p><table><thead><tr><th>颜色</th><th>HEX（RGB888）</th><th>DEC（RGB888）</th></tr></thead><tbody><tr><td><font color="#FE0302">红色</font></td><td><font color="#FE0302">FE0302</font></td><td><font color="#FE0302">16646914‬</font></td></tr><tr><td><font color="#FF7204">橘红</font></td><td><font color="#FF7204">FF7204</font></td><td><font color="#FF7204">16740868</font></td></tr><tr><td><font color="#FFAA02">橘黄</font></td><td><font color="#FFAA02">FFAA02</font></td><td><font color="#FFAA02">16755202</font></td></tr><tr><td><font color="#FFD302">淡黄</font></td><td><font color="#FFD302">FFD302</font></td><td><font color="#FFD302">16765698</font></td></tr><tr><td><font color="#FFFF00">黄色</font></td><td><font color="#FFFF00">FFFF00</font></td><td><font color="#FFFF00">16776960</font></td></tr><tr><td><font color="#A0EE00">草绿</font></td><td><font color="#A0EE00">A0EE00</font></td><td><font color="#A0EE00">10546688</font></td></tr><tr><td><font color="#00CD00">绿色</font></td><td><font color="#00CD00">00CD00</font></td><td><font color="#00CD00">52480</font></td></tr><tr><td><font color="#019899">墨绿</font></td><td><font color="#019899">019899</font></td><td><font color="#019899">104601</font></td></tr><tr><td><font color="#4266BE">紫色</font></td><td><font color="#4266BE">4266BE</font></td><td><font color="#4266BE">4351678</font></td></tr><tr><td><font color="#89D5FF">青色</font></td><td><font color="#89D5FF">89D5FF</font></td><td><font color="#89D5FF">9022215</font></td></tr><tr><td><font color="#CC0273">品红</font></td><td><font color="#CC0273">CC0273</font></td><td><font color="#CC0273">13369971</font></td></tr><tr><td><font color="#222222">黑色</font></td><td><font color="#222222">222222</font></td><td><font color="#222222">2236962</font></td></tr><tr><td><font color="#9B9B9B">灰色</font></td><td><font color="#9B9B9B">9B9B9B</font></td><td><font color="#9B9B9B">10197915</font></td></tr><tr><td><font color="#FFFFFF">白色</font></td><td><font color="#FFFFFF">FFFFFF</font></td><td><font color="#FFFFFF">16777215</font></td></tr></tbody></table>`,33)]))}const c=t(o,[["render",p]]),d=JSON.parse('{"path":"/docs/danmaku/danmaku_xml.html","title":"xml弹幕","lang":"zh-CN","frontmatter":{},"git":{"updatedTime":1738912203000,"contributors":[{"name":"SocialSisterYi","username":"SocialSisterYi","email":"1440239038@qq.com","commits":2,"url":"https://github.com/SocialSisterYi"},{"name":"LaMerChiang","username":"LaMerChiang","email":"catlair@qq.com","commits":1,"url":"https://github.com/LaMerChiang"},{"name":"SessionHu","username":"SessionHu","email":"102411014+SessionHu@users.noreply.github.com","commits":1,"url":"https://github.com/SessionHu"}],"changelog":[{"hash":"96ed6aae8af70c08daa04d42b8d27841adefa73d","time":1738912203000,"email":"102411014+SessionHu@users.noreply.github.com","author":"SessionHu","message":"feat(danmaku/danmaku_xml.md): pool 3"},{"hash":"ef919a61efd0a4813d95585fa0ebd24ce1d2988e","time":1693981546000,"email":"catlair@qq.com","author":"LaMerChiang","message":"chore: 升级为 vuepress@2 (#807)"},{"hash":"f6760f4be38d5b592d396b211e48c666286524de","time":1677124138000,"email":"1440239038@qq.com","author":"SocialSisterYi","message":"🔨remove header index"},{"hash":"7d89ece2ac46425810647c4ac92acf5f3721cb68","time":1676998806000,"email":"1440239038@qq.com","author":"SocialSisterYi","message":"🚀调整项目结构"}]},"filePathRelative":"docs/danmaku/danmaku_xml.md"}');export{c as comp,d as data};
