Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Paste
P8919
RC fetching script
Active
Public
Actions
Authored by
Smalyshev
on Aug 15 2019, 7:53 PM.
Edit Paste
Archive Paste
View Raw File
Subscribe
Mute Notifications
Award Token
Flag For Later
Tags
None
Referenced Files
F30041251: raw.txt
Aug 15 2019, 7:53 PM
2019-08-15 19:53:58 (UTC+0)
Subscribers
None
<?php
$NS
=
"0|120|146"
;
$url
=
"https://www.wikidata.org/w/api.php?format=json&action=query&list=recentchanges&rcdir=newer&rcprop=title|ids|timestamp&rcnamespace=$NS&rclimit=500"
;
$start
=
'20190813103000'
;
// $end does not really work for now
// $end = '20190813122000';
$url_data
=
$url
.
"&rcstart="
.
$start
;
do
{
$data
=
file_get_contents
(
$url_data
);
$cont
=
process_data
(
$data
);
$url_data
=
$url
.
"&continue=-||&rccontinue="
.
$cont
;
print
"Continuing with $cont
\n
"
;
}
while
(
$cont
);
function
process_data
(
$data
)
{
$jdata
=
json_decode
(
$data
,
true
);
$rc
=
$jdata
[
'query'
][
'recentchanges'
];
foreach
(
$rc
as
$rcitem
)
{
// if($rcitem['type'] != 'log') continue;
print
$rcitem
[
'title'
]
.
" "
.
$rcitem
[
'timestamp'
]
.
"
\n
"
;
}
return
$jdata
[
'continue'
][
'rccontinue'
];
}
Event Timeline
Smalyshev
created this paste.
Aug 15 2019, 7:53 PM
2019-08-15 19:53:58 (UTC+0)
Log In to Comment