Coder Social home page Coder Social logo

waie123 / hlsdownloader Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nurrony/hlsdownloader

0.0 0.0 0.0 916 KB

Downloads HLS Playlist file and TS chunks

Home Page: https://nmrony.github.io/hlsdownloader

License: MIT License

JavaScript 100.00%

hlsdownloader's Introduction

HLSDownloader

Greenkeeper badge version coding style: standard dependencies devDependencies Downloads Travis branch semantic-release

Downloads m3u8 playlist and TS chunks for a given playlist URL.

Installation

Install it via npm or yarn

[sudo] npm install hlsdownloader --save
# Or
[sudo] yarn add hlsdownloader

Configuration

destination field is optional. If destination is not provided it just fetches the content from origin. It can also be useful if you want to do content pre-fetching from CDN for your end viewers. If any TS or m3u8 variant download is failed it continues downloading others and reports after finishing.

It's simple as below.

import HLSDownloader from 'hlsdownloader' //Using ES2015 module
//var HLSDownloader = require('hlsdownloader').downloader; //using commonJS module

const params = {
  playlistURL: 'http://example.com/path/to/your/playlist.m3u8', // change it
  destination: '/tmp' // change it (optional field)
}
const downloader = new HLSDownloader(params)
downloader.startDownload((err, msg) => (err ? console.log(err) : console.log(msg)))

msg is an object with following properties

//on success
{
message: 'Downloaded successfully',
playlistURL: 'your playlist url'
}
//on partial download
{
message: 'Download done with some errors',
playlistURL: 'your playlist url',
errors: [] // items url that is skipped or could not downloaded for error
}

Advance Usage

HLSDownloader accepts all parameters supported by request-promise except these following options

  • method
  • uri
  • url
  • transform
  • resolveWithFullResponse
  • baseUrl
  • json
  • form
  • formData
  • preambleCRLF
  • postambleCRLF
  • jsonReviver
  • jsonReplacer

It helps you to do Auth, limit concurrency of download and other various tasks without changing your code and workflow.

I will be grateful if you all help me to improve this package by giving your suggestions, feature request and pull requests. I am all ears!!

hlsdownloader's People

Contributors

nurrony avatar greenkeeper[bot] avatar boushley avatar bitdeli-chef avatar snyk-bot avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.