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

hinet-hichannel-taiwan-radio

v4.0.0

Published

取得 HiNet hichannel 台灣電台的 m3u8 串流網址、節目表和其他資訊!

Downloads

19

Readme

HiNet hichannel 台灣電台 (Node.js 套件)

取得 HiNet hichannel 台灣電台的 m3u8 串流網址、節目表和其他資訊!

PHP 版本:https://github.com/GoneToneStudio/php-hinet-hichannel-taiwan-radio

注意

  • HiNet hichannel m3u8 串流網址會阻擋國外 IP 訪問 (HTTP 403 Forbidden)。
  • 播放端 IP 和用來取得 m3u8 串流網址的伺服器 IP 要是相同的,不然無法播放 (HTTP 403 Forbidden),可以嘗試在伺服端處理好在串流給播放端,就二次串流。

問題

如果發現任何 BUG,請在此回報:https://github.com/GoneToneStudio/node-hinet-hichannel-taiwan-radio/issues

安裝

需要 Node.js 14.0.0 或更高版本。

npm install hinet-hichannel-taiwan-radio

取得 Hichannel 頻道名稱方法

  1. 前往 HiNet hichannel 網站
  2. 點選您想要聽的電台並確認可以播放
  3. 複製完整頻道名稱,使用時名稱要完全一樣 (如果不能直接複製可以利用 F12,或者就乖乖用打的XDD)

使用範例

const { HiNetHichannel } = require('hinet-hichannel-taiwan-radio')

const hichannel = new HiNetHichannel()

/* 取得所有電台頻道列表 */
hichannel.getChannels().then((channels) => {
  console.log('所有電台頻道列表:')
  console.log(channels)
})

/* 利用關鍵字搜尋取得電台頻道列表 */
hichannel.getChannels('警廣').then((channels) => {
  console.log('關鍵字搜尋電台頻道列表:')
  console.log(channels)
})

/* 取得熱門排行電台頻道列表 */
hichannel.getRankingChannels().then((channels) => {
  console.log('熱門排行電台頻道列表:')
  console.log(channels)
})

/* 取得指定電台頻道資料 */
hichannel.getChannel('KISS RADIO 大眾廣播電台').then((channel) => { // 請輸入完整頻道名稱
  console.log('指定電台頻道資料:')
  console.log(channel)
})

/* 設定電台頻道 */
hichannel.setChannel('KISS RADIO 大眾廣播電台') // 請輸入完整頻道名稱

/* 取得電台頻道 m3u8 串流網址 */
hichannel.getChannelM3u8Url().then((m3u8Url) => {
  console.log(`電台頻道 m3u8 串流網址:${m3u8Url}`)
})

/* 取得電台頻道節目資訊 */
hichannel.getChannelProgramInfo().then((info) => {
  console.log('電台頻道節目資訊:')
  console.log(info)
})

代理 (Proxy)

如果運行此程式的伺服器不在台灣,請設定台灣的 Proxy 伺服器,否則取得的串流網址會驗證失敗 (HTTP 403 Forbidden),但如果播放端 IP 和用來取得 m3u8 串流網址的伺服器 IP 不同一樣會被阻擋就是了,可以嘗試在伺服端處理好在串流給播放端,就二次串流。

const { HiNetHichannel, Proxy } = require('hinet-hichannel-taiwan-radio')

/* 連線到 Proxy 伺服器 */
const proxy = new Proxy({
  host: '主機名',
  port: 3128,
  protocol: 'http'
})
// proxy.login('帳號', '密碼') // 如果 Proxy 伺服器需要驗證,請調用這登入

const hichannel = new HiNetHichannel(proxy)

License

MIT