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

bilibilispider

v0.5.5

Published

这是一个用于个人获取b站数据的前端爬虫库,请求部分由我的项目 JSpider 2.0 完成,而数据转换成 xlsx 文件的部分由 sheetjs 完成。而相关js插件都是通过 jsdelivr 的 api 导入的。

Readme

Bilibili Spider库

简介

这是一个用于个人获取b站数据的前端爬虫库,请求部分由我的项目 JSpider 2.0 完成,而数据转换成 xlsx 文件的部分由 sheetjs 完成。而相关js插件都是通过 jsdelivr 的 api 导入的。

这个库可以实现输入简单的几个字 直接爬取到 xlsx 文件!!

没错,一步到位,所有的数据直接转化为 Excel 能够打开的文件,前端爬虫就是如此轻松!

这个库仅仅用于个人爬虫研究,请勿用于非法行为。

作者的闲聊

日期:2021-1-4

我在练习爬虫的时候,对 b站的 api 稍有研究(需要做作业),所以写了一下 b 站的爬虫,发现 b 站的 api 没有设置很多的反爬手段(从前端JS的角度看毫无难度),所以整合了一下 b 站的爬虫代码,做成了这个库。

这个库用在哪里?怎么用?

这个库用在 https://www.bilibili.com/页面 的开发者工具的 Console 中,注意在其他网站可能会不成功,直接在 b站主页 是肯定能爬取的。

(开发者工具不会用?右键 -> 检查 -> Console 页面)

在那里输入下面这行代码

import('https://cdn.jsdelivr.net/npm/bilibilispider/index.js')

等待提示加载完成即可。对的,没有复杂的安装代码,自动解决

然后你可以输入 _Bilibili 看看有什么工具可以使用。

各个工具的使用方式

全部的函数都封装在 _Bilibili 这个变量里面了,用就完事了。 为了防止我以后忘记了怎样使用这个爬虫工具,我顺便把函数的名字多加了中文版本,中文名称没什么好说的。

|函数名|例子|注意事项| |-|-|-| |全站排名获取|_Bilibili.全站排名获取()|这是获取爬取的时候的时间点的排名| |全部番剧信息收集|_Bilibili.全部番剧信息收集()|这是获取爬取的时候B站的番剧信息| |在站内搜索|_Bilibili.在站内搜索('搜索信息')|这是直接爬取全部的搜索信息,注意是全部,大概数量在1000左右| |UP主相簿信息|_Bilibili.UP主相簿信息(000000)|爬取 ID 为 000000 的 UP 主的相簿信息| |UP主视频信息|_Bilibili.UP主相簿信息(000000)|爬取 ID 为 000000 的 UP 主的视频信息| |BV转AV|_Bilibili.BV转AV('BV0000000')|转换BV号为AV号| |某视频的评论区|_Bilibili.某视频的评论区(0000000)|爬取 AV号 为 000000 的视频评论区| |某些视频的信息|_Bilibili.某些视频的信息(['000000'])|爬取BV号为000000(可以为数组)的视频信息|

关于B站的各种id 2333

B 站ID有好多种,找了我好久菜看懂 |意义|前缀| |-|-| |第一代视频ID|av,aid| |第二代视频ID|bv,bid,bvid| |专栏ID|cv,cvid| |番剧编号|ep| |UP主编号|mid| |好像是统一的编号|cid| |看情况,这个出现在请求参数种,一般和aid一致|oid| 一般来说,只要是视频都有aid,包括番剧和普通的视频,专栏使用 cvid。

使用者注意

如果是做一个作业的话,是可以直接使用的,b 站没有太严格的反爬措施,只要不是并发 3,delay 0,数量在1000 就没有多大的问题,如果请求过快,会导致你的浏览器有一段时间请求不了b站的信息,表现为打不开网页或数据不会刷新,但不用担心,等一会就会正常的。

所有的请求默认都会从浏览器缓存中取出。也就是说,你使用过一次函数,第二次使用它时,如果浏览器会优先从缓存中找这些结果。

关于这个项目

这个项目尚未完成,我想把评论区和视频的爬虫脚本也做了,但是考虑到视频下载的话很难做,而且有油猴插件已经可以完成这个任务了,所以想要获取视频的同学还是用插件吧。

关于 JSpider 2.0 系列

JSpider 2.0 是关注于前端如何去快速爬取一些URL的库,在我编写的时候还没有形成对数据的保存意识。在学过前端存储之后,发现完全可以在浏览器里面存数据(而且我的上一个大型爬虫项目在浏览器里面存了1G多数据,没有什么影响),所以着手准备 3.0 的版本。