Skip to content

Instantly share code, notes, and snippets.

@badrazizi
Created April 1, 2018 03:41
Show Gist options
  • Save badrazizi/71c789e893322fe7dfbb410668cfeeea to your computer and use it in GitHub Desktop.
Save badrazizi/71c789e893322fe7dfbb410668cfeeea to your computer and use it in GitHub Desktop.
javascript TUNE.PK Video Links Extractor
const $ = require('jquery');
// Extract TUNE.PK Links
function TUNEPK(link, callback) {
$.get(link)
.done(function(data, status) {
let start = data.indexOf('"sources":');
let end = data.indexOf(',"configurations":');
let json = '{' + data.substr(start, (end % start)) + '}';
json = JSON.parse(json);
if (json.sources != null) {
callback(json.sources);
} else {
callback(status);
}
})
.fail(function(data, status) {
callback(status);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment