Skip to content

Commit

Permalink
fix: filter out non-media streams from dash manifest
Browse files Browse the repository at this point in the history
  • Loading branch information
fent committed Oct 20, 2020
1 parent ca9668e commit 646a5cf
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/info.js
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,9 @@ const getDashManifest = (url, options) => new Promise((resolve, reject) => {
parser.onopentag = node => {
if (node.name === 'REPRESENTATION') {
const itag = parseInt(node.attributes.ID);
formats[itag] = { itag, url };
if (!isNaN(itag)) {
formats[itag] = { itag, url };
}
}
};
parser.onend = () => { resolve(formats); };
Expand Down Expand Up @@ -287,7 +289,7 @@ const getM3U8 = async(url, options) => {
.filter(line => /https?:\/\//.test(line))
.forEach(line => {
const itag = parseInt(line.match(/\/itag\/(\d+)\//)[1]);
formats[itag] = { itag: itag, url: line };
formats[itag] = { itag, url: line };
});
return formats;
};
Expand Down

0 comments on commit 646a5cf

Please sign in to comment.