Page MenuHomePhabricator

phantomjs

Authored By
Ejegg
Dec 3 2016, 12:23 AM
Size
1 KB
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 ( !mediaWiki.centralNotice ) {
return false;
}
if ( mediaWiki.centralNotice.choiceData && mediaWiki.centralNotice.data ) {
return {
data: mediaWiki.centralNotice.data,
choiceData: mediaWiki.centralNotice.choiceData,
choiceVersion: mediaWiki.loader.getVersion('ext.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
4178173
Default Alt Text
phantomjs (1 KB)

Event Timeline