基于 bilibili-parse 的 B站视频解析接口。支持 BV/AV 号、多种清晰度、多种输出格式,免费稳定。
支持 BV 号和 AV 号两种视频编号格式,兼容所有 B站视频。
支持番剧 EP 编号解析,type=bangumi 即可解析番剧内容。
支持 360P 到 1080P 多种清晰度,自动降级到可用清晰度。
支持 FLV、DASH、MP4 三种视频格式,满足不同场景需求。
解析 B站视频,返回 JSON 格式的视频信息。
curl "https://yuri.fan/bili/?bv=BV1zYKf6jENs&p=1&q=80&otype=json"
直接返回视频直链 URL,浏览器可直接播放或下载。
curl -L "https://yuri.fan/bili/?bv=BV1zYKf6jENs&p=1&q=80&otype=url" -o video.mp4
返回 DPlayer 播放器页面,可直接嵌入 iframe 播放。
<iframe src="https://yuri.fan/bili/?bv=BV1zYKf6jENs&p=1&q=80&otype=dplayer"
width="100%" height="500" frameborder="0">
</iframe>
解析番剧,使用 EP 编号和 type=bangumi 参数。
curl "https://yuri.fan/bili/?ep=123456&type=bangumi&otype=json"
| 参数 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
bv |
string | 二选一 | - | 视频 BV 号,如 BV1zYKf6jENs |
av |
string | 二选一 | - | 视频 AV 号,如 av14661594 |
ep |
string | 番剧用 | - | 番剧 EP 编号,需配合 type=bangumi |
p |
int | 选填 | 1 |
视频分P序号,从 1 开始 |
q |
int | 选填 | 32 |
视频清晰度代码 |
type |
string | 选填 | video |
video / bangumi |
format |
string | 选填 | flv |
flv / dash / mp4 |
otype |
string | 选填 | json |
json / url / dplayer |
cookie |
string | 选填 | - | SESSDATA Cookie,用于解锁 1080P。格式:SESSDATA=xxx |
cookie 参数。bilibili.com → 复制 SESSDATA 的值。&cookie=SESSDATA=你的值
通过 URL 参数直接传入 Cookie,即可解锁 1080P。
curl "https://yuri.fan/bili/?bv=BV1zYKf6jENs&p=1&q=80&otype=json&cookie=SESSDATA=abc123"
curl -L "https://yuri.fan/bili/?bv=BV1zYKf6jENs&p=1&q=80&otype=url&cookie=SESSDATA=abc123" -o video.mp4
async function getBiliVideo(bv, p = 1, q = 80) {
const url = `https://yuri.fan/bili/?bv=${bv}&p=${p}&q=${q}&otype=json`;
const response = await fetch(url);
const data = await response.json();
console.log('标题:', data.title);
console.log('视频链接:', data.url);
console.log('清晰度:', data.quality);
return data;
}
getBiliVideo('BV1zYKf6jENs', 1, 80);
import requests
def get_bili_video(bv, p=1, q=80):
url = f'https://yuri.fan/bili/'
params = {
'bv': bv,
'p': p,
'q': q,
'otype': 'json'
}
response = requests.get(url, params=params, timeout=30)
data = response.json()
print(f"标题: {data.get('title')}")
print(f"视频链接: {data.get('url')}")
print(f"清晰度: {data.get('quality')}")
return data
# 下载视频
def download_video(bv, p=1, q=80, output='video.mp4'):
url = f'https://yuri.fan/bili/?bv={bv}&p={p}&q={q}&otype=url'
response = requests.get(url, timeout=60)
with open(output, 'wb') as f:
f.write(response.content)
print(f'已保存到 {output}')
get_bili_video('BV1zYKf6jENs')
download_video('BV1zYKf6jENs', output='test.mp4')
<?php
function getBiliVideo($bv, $p = 1, $q = 80) {
$url = 'https://yuri.fan/bili/?' . http_build_query([
'bv' => $bv,
'p' => $p,
'q' => $q,
'otype' => 'json'
]);
$response = file_get_contents($url);
$data = json_decode($response, true);
echo "标题: " . $data['title'] . "
";
echo "链接: " . $data['url'] . "
";
return $data;
}
getBiliVideo('BV1zYKf6jENs');
<!-- DPlayer 播放器 -->
<iframe
src="https://yuri.fan/bili/?bv=BV1zYKf6jENs&p=1&q=80&otype=dplayer"
width="100%"
height="500"
frameborder="0"
allowfullscreen>
</iframe>
<!-- 或直接跳转播放 -->
<a href="https://yuri.fan/bili/?bv=BV1zYKf6jENs&p=1&q=80&otype=url" target="_blank">
点击播放
</a>
otype=json 返回完整视频信息(标题、封面、各清晰度链接等)。otype=url 直接返回最佳视频直链,适合下载或播放。otype=dplayer 返回完整播放器页面,适合 iframe 嵌入。