- _PHANTOMJS_SCRIPT = r'''
- phantom.onError = function(msg, trace) {
- var msgStack = ['PHANTOM ERROR: ' + msg];
- if(trace && trace.length) {
- msgStack.push('TRACE:');
- trace.forEach(function(t) {
- msgStack.push(' -> ' + (t.file || t.sourceURL) + ': ' + t.line
- + (t.function ? ' (in function ' + t.function +')' : ''));
- });
- }
- console.error(msgStack.join('\n'));
- phantom.exit(1);
- };
- var page = require('webpage').create();
- page.settings.resourceTimeout = 10000;
- page.onInitialized = function() {
- page.evaluate(function() {
- delete window._phantom;
- delete window.callPhantom;
- });
- };
- page.open('https://openload.co/embed/%s/', function(status) {
- var info = page.evaluate(function() {
- return {
- decoded_id: document.getElementById('streamurl').innerHTML,
- title: document.querySelector('meta[name="og:title"],'
- + 'meta[name=description]').content
- };
- });
- console.log(info.decoded_id + ' ' + info.title);
- phantom.exit();
- });'''