Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Paste
P4559
phantomjs
Active
Public
Actions
Authored by
Ejegg
on Dec 2 2016, 7:57 PM.
Edit Paste
Archive Paste
View Raw File
Subscribe
Mute Notifications
Award Token
Flag For Later
Tags
MediaWiki-extensions-CentralNotice
Subscribers
None
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'
);
Event Timeline
Ejegg
created this paste.
Dec 2 2016, 7:57 PM
2016-12-02 19:57:10 (UTC+0)
Ejegg
added a comment.
Dec 2 2016, 8:53 PM
2016-12-02 20:53:01 (UTC+0)
Comment Actions
aha, page.open callback seems to fire before window.mediaWiki is set up
Ejegg
edited the content of this paste.
(Show Details)
Dec 2 2016, 11:08 PM
2016-12-02 23:08:06 (UTC+0)
Ejegg
edited the content of this paste.
(Show Details)
Dec 3 2016, 12:23 AM
2016-12-03 00:23:18 (UTC+0)
Ejegg
added a project:
MediaWiki-extensions-CentralNotice
.
Ejegg
mentioned this in
T152122: Central Notice: possible CN issue early on December 1st UTC
.
Ejegg
edited the content of this paste.
(Show Details)
Dec 3 2016, 3:45 AM
2016-12-03 03:45:51 (UTC+0)
Log In to Comment