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

douyu-api

v0.2.1

Published

douyu api

Readme

API 文档

安装

npm i douyu-api

使用

import { video } from "douyu-api";
video.parseVideo(url);

video函数列表(斗鱼视频相关)

getDanmu

获取原始视频弹幕,如果你想获取完整视频弹幕,推荐直接使用下一个getVideoDanmu函数

参数:

  • vid (string): 视频 ID
  • startTime (number): 开始时间
  • endTime (number, 可选): 结束时间,默认为 -1

返回:

  • Promise<any>: 弹幕数据

getVideoDanmu

获取视频所有弹幕,如果你想转为 b 站兼容的弹幕格式,使用convert2Xml函数

参数:

  • vid (string): 视频 ID

返回:

  • Promise<DanmuItem[]>: 弹幕项列表

parseVideo

解析视频页。

参数:

  • url (string): 视频 URL

返回:

  • Promise<Video>: 视频数据

getVideos

获取所有分 p 视频。

参数:

  • videoId (string): 视频 ID
  • upId (string): 上传者 ID

返回:

  • Promise<object>: 视频列表数据

getStreamUrls

获取视频流。

参数:

  • data (string): 请求数据,使用parseVideo返回的decodeData参数

返回:

  • Promise<object>: 视频流数据

getReplayList

获取回放视频列表。

参数:

  • params (object): 请求参数
    • up_id (string): 上传者 ID
    • page (number): 页码
    • limit (number): 每页数量

返回:

  • Promise<object>: 回放视频列表数据

getFishBarId

获取鱼吧 ID。

参数:

  • roomId (number): 直播间 ID

返回:

  • Promise<number>: 鱼吧 ID

getFishBarVideoList

获取鱼吧视频列表。

参数:

  • params (object): 请求参数
    • type (1 | 2): 类型
    • group_id (number): 群组 ID
    • page (number): 页码
    • lastid (number): 最后一个视频 ID

返回:

  • Promise<object>: 鱼吧视频列表数据

live相关函数(直播相关)

parseRoomId

通过一个链接尝试解析出斗鱼的直播间号

getRoomInfo

获取直播间信息。

参数:

  • roomId (number): 直播间 ID

返回:

  • Promise<object>: 直播间信息

getLiveInfo

对斗鱼 getH5Play 接口的封装,用于获取获取直播流

参数:

  • roomId (number): 直播间 ID