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 🙏

© 2024 – Pkg Stats / Ryan Hefner

mogu-api

v1.0.10

Published

蘑菇视频 API 接口

Downloads

6

Readme

mogu-api

蘑菇视频 API 接口

快速开始

npm install mogu-api

按需导入您需要的功能

import {
    getVideoInfo,
    getHlsText,
    parseHlsURL,
    getAESConfig,
    loadVideo,
    getVideoSearchResult,
    getAllLabels,
    getVideoTypeMenu,
    getVideoListByType,
    downloadFile
} from 'mogu-api'

API 文档

  • getVideoInfo: (videoId: number | string) => Promise

    获取视频信息,返回视频标题、视频播放地址等

  • getHlsText: (videoUrl: string, videoId: number | string) => Promise

    获取视频 M3U8 字符串,输入加密的 M3U8 地址,解密并输出 M3U8 内容

  • parseHlsURL: (videoUrl: string, videoId: number | string) => Promise

    解密视频地址并返回可播放的 Hls URL,输入加密的 M3U8 地址,输出可直接播放的 Hls 地址

  • getAESConfig: (videoId: number | string) => { key: lib.WordArray, iv: lib.WordArray }

    获取 AES 配置信息,返回解密时需要的密钥和偏移量

  • loadVideo: (videoId: number | string, element: HTMLMediaElement) => Promise

    将视频载入到视频元素,根据视频 ID 获得解密后的 M3U8 字符串,创建 ObjectURL 对象,然后通过 Hls 将视频载入到视频元素中

  • getVideoSearchResult: (keyword: string, page?: number, pageSize?: number) => Promise<VideoListItem[]>

    获取视频搜索结果

  • getAllLabels: () => Promise<{ id: number, name: string }[]>

    获取所有的标签

  • getVideoTypeMenu: () => Promise

    获取视频分类菜单

  • getVideoListByType: (typeIds: number[], options?: { page?: number, pageSize?: number, order?: 'stat' | 'view' | 'id' }) => Promise<VideoListItem[]>

    获取分类视频列表

  • downloadFile: (objectURL: string, filename: string) => void

    下载文件

  • getImageBase64Src: (imageUrl: string) => Promise

    将图片转换为 Base64 格式,返回值可直接设置为图片元素的 src 属性