Page MenuHomePhabricator

phantomjs

Authored By
Ejegg
Dec 2 2016, 11:08 PM
Size
856 B
Referenced Files
None
Subscribers
None

phantomjs

phantom.clearCookies();
var page = require('webpage').create();
page.onResourceReceived = function(response) {
var headers = response.headers,
len = headers.length,
i = 0;
for (i=0; i< len; i++) {
if ( headers[i].name == "Set-Cookie" ) {
console.log( JSON.stringify({ cookie: headers[i].value} ));
}
}
var data = page.evaluate( function() {
if ( !window.mediaWiki ) {
return false;
}
if ( !window.mediaWiki.centralNotice ) {
return false;
}
if ( window.mediaWiki.centralNotice.choiceData && window.mediaWiki.centralNotice.data ) {
return { data: window.mediaWiki.centralNotice.data,
choiceData: window.mediaWiki.centralNotice.choiceData
};
} else {
return false;
}
} );
if ( data ) {
console.log( JSON.stringify( data ));
phantom.exit();
}
};
page.open('https://en.wikipedia.org/wiki/Fla-Vor-Ice');

File Metadata

Mime Type
text/plain; charset=utf-8
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4178080
Default Alt Text
phantomjs (856 B)

Event Timeline