Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F4950427
phantomjs
No One
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Authored By
Ejegg
Dec 3 2016, 3:45 AM
2016-12-03 03:45:51 (UTC+0)
Size
1 KB
Referenced Files
None
Subscribers
None
phantomjs
View Options
phantom.clearCookies();
var page = require('webpage').create(),
system = require('system'),
gotCookie = false;
page.onResourceReceived = function(response) {
var headers = response.headers,
len = headers.length,
i = 0;
if ( !gotCookie ) {
for ( i=0; i< len; i++ ) {
if ( headers[i].name == "Set-Cookie" ) {
console.log( JSON.stringify({ cookie: headers[i].value} ));
gotCookie = true;
}
}
}
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();
}
};
var lang = 'en';
if (system.args.length > 1) {
lang = system.args[1];
}
page.open('https://' + lang + '.wikipedia.org/wiki/Special:Random');
File Metadata
Details
Attached
Mime Type
text/plain; charset=utf-8
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4178370
Default Alt Text
phantomjs (1 KB)
Attached To
Mode
P4559 phantomjs
Attached
Detach File
Event Timeline
Log In to Comment