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

@x-edu/whiteboard

v3.1.1

Published

资源接入sdk

Downloads

18

Readme

@x-edu/whiteboard

Demo

2.0.0之后版本示例见羽雀文档

import {
  NDRRequest,
  CDNEnv
} from '@x-edu/whiteboard'

// 设置环境,test为百度测试环境,product为百度正式环境
NDRRequest.setEnv(CDNEnv.test)
// 开启测试,将使用测试地址
NDRRequest.setIsTest(true)
// 开启测试解析,强制注入加密信息
NDRParser.setIsTest(true)
// 请求教材列表
const teachingmaterials = await NDRRequest.getTeachingMaterialList()
console.log('teachingmaterials', teachingmaterials)

// 请求教材标签树
const tags = await NDRRequest.getTeachingMaterialTags()
console.log('tags', tags)

// 请求教材详情
const teachingMaterialDetail = await NDRRequest.getTeachingMaterialDetail(teachingmaterials[0].id)
console.log('teachingMaterialDetail', teachingMaterialDetail)

// 请求教材章节
const chapters = await NDRRequest.getTeachingMaterialChapters(teachingmaterials[0].id)
console.log('chapters', chapters)

// 请求教材的课程列表
const lessons = await NDRRequest.getTeachingMaterialLessons(teachingmaterials[0].id)
console.log('lessons', lessons)

// 请求教材详情
const lessonDetail = await NDRRequest.getNationalLessonDetail(lessons[0].id)
console.log('lessonDetail', lessonDetail)

// 请求课程关联的精品课列表
const elite = await NDRRequest.getNationalLessonRelateEliteLesson(lessons[0].id)
console.log('elite', elite)

// 请求课程关联的讲师信息
const lecture = await NDRRequest.fetchLectureLessons('d7698529-7723-4672-87c5-2e77fb9da32a')
console.log('lecture', lecture)

// 解析课程资源数据
const lessonResourceData = NDRParser.parseLessonResource(lessonDetail)
console.log('resourceData', lessonResourceData)

// 解析课程视频资源
const videoData = await NDRParser.parseResource(
  lessonResourceData.resourceData[0].resources[0]
)
console.log('videoData', videoData)

// 解析课程文档资源
const documentData = await NDRParser.parseResource(
  lessonResourceData.resourceData[0].resources[1]
)
console.log('documentData', documentData)

// 地址转换
const tiUrl = await NDRParser.getTiItemUrl(lessonResourceData
    .resourceData[0]
    .resources[1]
    .ti_items[0])
console.log('tiUrl', tiUrl)


const authHeader = await NDRParser.getAuthHeader()
console.log('authHeader', authHeader)