本项目已收到哔哩哔哩(bilibili)律师函,要求停止对 B 站 API 的调用及相关仿制行为。

为尊重知识产权及相关法律法规,本仓库即日起停止后续维护与更新,不再接受新的 Issue 和 Pull Request。

现有代码仅作学习参考保留,请勿将本项目用于任何商业或违法用途。

感谢所有支持过本项目的朋友。
This commit is contained in:
Developer
2026-05-12 21:29:45 +08:00
parent 53c67079a1
commit 6e0dc2729c
16 changed files with 1304 additions and 453 deletions

View File

@@ -1,4 +1,4 @@
import { useState, useCallback, useRef } from 'react';
import { useState, useCallback, useEffect, useRef } from 'react';
import { getVideoRelated } from '../services/bilibili';
import type { VideoItem } from '../services/types';
@@ -7,6 +7,11 @@ export function useRelatedVideos(bvid: string) {
const [loading, setLoading] = useState(false);
const loadingRef = useRef(false);
// 切到不同 bvid 时立刻清空,避免新页面短暂显示上一支视频的推荐流
useEffect(() => {
setVideos([]);
}, [bvid]);
const load = useCallback(async () => {
if (loadingRef.current) return;
loadingRef.current = true;