Skip to content

Instantly share code, notes, and snippets.

@samelie
samelie / requestIndexRange
Created February 17, 2016 23:31
Youtube SIDX parsed from index range on dash video
//the index range will be eg: 0-917
// you can find the index range of a particular dash video insode the ytplayer.config
// https://github.com/fent/node-ytdl-core
function sidxFromInitRange(url, indexRange) {
return new Q(function(resolve, reject) {
var XMLHttpRequest = require('xhr2');
var xhr = new XMLHttpRequest();
xhr.open('GET', url);
xhr.setRequestHeader("Range", "bytes=" + indexRange);
xhr.send();