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

qt-lyric

v1.0.5

Published

typescript rollup 歌词解析

Downloads

9

Readme

歌词解析 For Typescript

Getting Started

Install dependencies

$ npm i qt-lyric --save

字符串 歌词


import {  qtLyric, updateLine } from 'qt-lyric'

const lrc = '[id:$00000000]\r\n[ar:方季惟]\r\n[ti:怨苍天变了心]\r\n[by:]\r\n[hash:2b90877cd069c68e3ff12360bdc86075]\r\n[al:]\r\n[sign:]\r\n[qq:]\r\n[total:243000]\r\n[offset:0]\r\n[00:00.19]方季惟 - 怨苍天变了心\r\n[00:01.25]作词:何厚华\r\n[00:01.44]作曲:徐嘉良\r\n[00:29.88]如果让我遇见你\r\n[00:32.25]而你正当年轻\r\n[00:35.01]用最真的心换你最深的情\r\n[00:41.66]如果让你遇见我\r\n[00:43.96]而我依然年轻\r\n[00:46.76]也相信永恒是不变的曾经\r\n[00:53.37]如果让我离开你\r\n[00:55.74]而你已能平静\r\n[00:58.38]只愿你放心也不要你担心\r\n[01:05.16]如果让你离开我\r\n[01:07.52]假装我也平静\r\n[01:10.31]就算是伤心也当作是无心\r\n[01:17.55]时空阻隔岂止长路迢迢\r\n[01:22.30]情丝缠绕岂是长发飘飘\r\n[01:26.68]那红尘俗世的人\r\n[01:29.34]为什么总是多情惹烦恼\r\n[01:38.11]本是云该化作雨\r\n[01:40.48]投入海的胸襟\r\n[01:43.27]却含着泪水任孤独的飘零\r\n[01:49.97]本是属于我的你\r\n[01:52.27]同把人生看尽\r\n[01:54.88]却无缘再聚怨苍天变了心\r\n[02:39.65]如果让我离开你\r\n[02:41.88]而你已能平静\r\n[02:44.38]只愿你放心也不要你担心\r\n[02:51.18]如果让你离开我\r\n[02:53.55]假装我也平静\r\n[02:56.25]就算是伤心也当作是无心\r\n[03:03.60]时空阻隔岂止长路迢迢\r\n[03:08.34]情丝缠绕岂是长发飘飘\r\n[03:12.82]那红尘俗世的人\r\n[03:15.38]为什么总是多情惹烦恼\r\n[03:24.11]本是云该化作雨\r\n[03:26.55]投入海的胸襟\r\n[03:29.16]却含着泪水任孤独的飘零\r\n[03:36.00]本是属于我的你\r\n[03:38.37]同把人生看尽\r\n[03:40.97]却无缘再聚怨苍天变了心\r\n[03:48.32]无缘再聚怨苍天变了心\r\n'

const lyricList = qtLyric(lrc)

console.log(lyricList)

  /**
   *  @param  lineNum       当前播放行
   *  @param  txt           当前播放内容
   *  @param  durationTime  当前播放持续时长     like  2979
   *  @param  timestamp     当前行时间戳         like  67052
   *  @param  time          当前行时间           like  01:07.52
   */

const updateTime = updateLine(lyricList, function ({lineNum, txt, durationTime, timestamp, time }) {
  
  console.log(`lineNum::${lineNum}, txt::${txt}, durationTime::${durationTime}, timestamp::${timestamp}, time::${time}`)

  })

// currentTime 当前播放时间
  const currentTime = 1200 

  updateTime(currentTime)

数组 歌词


import {  qtLyric, updateLine } from 'qt-lyric'

  const lrc = [
    {
      lineLyric: '怨苍天变了心 - 方季惟',
      time: '0.0',
    },
    {
      lineLyric: '词:何厚华',
      time: '9.96',
    },
    {
      lineLyric: '曲:徐嘉良',
      time: '19.92',
    },
    {
      lineLyric: '如果让我遇见你而你正当年轻',
      time: '29.88',
    },
   ........ 
  ]

const lyricList = qtLyric(lrc)

console.log(lyricList)

const updateTime = updateLine(lyricList, function ({lineNum, txt, durationTime, timestamp, time }) {
  
  console.log(`lineNum::${lineNum}, txt::${txt}, durationTime::${durationTime}, timestamp::${timestamp}, time::${time}`)

  })

// currentTime
  const currentTime = 1200 

  updateTime(currentTime)