Created
April 1, 2018 03:41
-
-
Save badrazizi/71c789e893322fe7dfbb410668cfeeea to your computer and use it in GitHub Desktop.
javascript TUNE.PK Video Links Extractor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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