npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

mcp-bilibili-directories

v0.3.0

Published

B站视频选集信息爬取MCP插件 - 输入关键词和视频数量,输出文本格式的选集信息

Readme

B站视频选集信息爬取MCP插件

功能

  • 通过 Selenium 模拟真实浏览行为,搜索关键词并提取前 N 个视频的选集标题
  • 输入关键词和视频数量,输出文本格式的选集信息
  • 支持MCP协议,可作为插件使用

项目结构

├── crawler.py           # 核心爬虫逻辑(MCP插件专用)
├── mcp_server.py        # MCP 服务器
├── index.js            # Node.js启动器
├── package.json        # 项目配置
├── requirements.txt    # Python依赖
├── msedgedriver.exe    # Edge驱动
└── README.md           # 说明文档

安装

1. 安装Python依赖

pip install -r requirements.txt

2. 准备Edge驱动

  • 确保本机安装了 Microsoft Edge 浏览器
  • 下载对应版本的 msedgedriver.exe 并放在项目根目录
  • 下载地址:https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/

使用

方式1:直接运行测试

python crawler.py

方式2:作为MCP插件使用

本地启动

python mcp_server.py

通过npx启动(推荐)

npx [email protected]

工具参数

  • 工具名称:crawl_bilibili_directories
  • 输入参数:
    • keyword (string): 搜索关键词,如 "Python教程"
    • video_count (integer): 要处理的视频数量,1-10,默认5
  • 输出:文本格式的选集信息,包含视频标题、UP主、选集列表

方式3:Python代码调用

from crawler import crawl_bilibili

# 搜索"Python教程",获取3个视频的选集信息
result = crawl_bilibili("Python教程", 3)

if "error" in result:
    print(f"错误: {result['error']}")
else:
    print(f"搜索关键词: {result['search_keyword']}")
    print(f"成功处理视频数量: {result['total_videos']}")
    for i, text in enumerate(result['text_results'], 1):
        print(f"\n=== 第{i}个视频 ===")
        print(text)

配置说明

  • 默认无头模式运行(headless=True)
  • 支持自定义用户代理和延时设置
  • 自动处理反爬虫检测

注意事项

  • 尊重B站服务条款,避免高频请求
  • 页面结构变化可能需要更新选择器
  • 确保网络连接稳定

故障排查

  • EdgeDriver问题:确认 msedgedriver.exe 版本与Edge浏览器匹配
  • 网络超时:检查网络连接,可能需要调整延时设置
  • 选择器失效:B站页面结构变化时,需要更新CSS选择器

发布到npm(可选)

如果你想发布到npm供其他人使用:

  1. 登录npm账户:npm login
  2. 修改 package.json 中的包名和作者信息
  3. 发布:npm publish --access public
  4. 其他人可以使用:npx <你的包名>