Skip to content

Instantly share code, notes, and snippets.

@bentogoa
Forked from Tithen-Firion/openload.js
Last active April 4, 2019 11:03
Show Gist options
  • Save bentogoa/cdaa3b6f64cc9c8bc27400a3554fac8d to your computer and use it in GitHub Desktop.
Save bentogoa/cdaa3b6f64cc9c8bc27400a3554fac8d to your computer and use it in GitHub Desktop.
Openload: extract download URL using PhantomJS
// Usage: phantomjs openload.js <video_url>
// if that doesn't work try: phantomjs --ssl-protocol=any openload.js <video_url>
var separator = ' | ';
var page = require('webpage').create(),
system = require('system'),
id, match;
if(system.args.length < 2) {
console.error('No URL provided');
phantom.exit(1);
}
match = system.args[1].match(
/https?:\/\/(?:openload\.(?:co|io)|oload\.tv)\/(?:f|embed)\/([\w\-]+)/);
if(match === null) {
console.error('Could not find video ID in provided URL');
phantom.exit(2);
}
id = match[1];
// thanks @Mello-Yello :)
page.onInitialized = function() {
page.evaluate(function() {
delete window._phantom;
delete window.callPhantom;
});
};
page.settings.userAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36";
page.open('https://openload.co/embed/' + id + '/', function(status) {
var info = page.evaluate(function() {
return {
decoded_id: document.getElementById('lqEH1').innerHTML,
title: document.querySelector('meta[name="og:title"],'
+ 'meta[name=description]').content
};
});
var url = 'https://openload.co/stream/' + info.decoded_id + '?mime=true';
console.log(url + separator + info.title);
phantom.exit();
});
@bentogoa
Copy link
Author

bentogoa commented Jan 8, 2018

Works as on 8-Jan-2018.

@bentogoa
Copy link
Author

bentogoa commented Apr 9, 2018

Updated / works as on 9-April-2018

@josefandersson
Copy link

I love you
(no homo)

@bentogoa
Copy link
Author

Updated / Works as on 14-March-2019

@MikeHosh
Copy link

MikeHosh commented Apr 4, 2019

4th April, not working

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment