On Mon, Mar 31, 2008 at 9:52 PM, Bryan Tong Minh bryan.tongminh@gmail.com wrote:
On Mon, Mar 31, 2008 at 10:16 PM, magnusmanske@svn.wikimedia.org wrote:
+// Fake user agent +ini_set('user_agent','MSIE 4.0b2;');
You should probably fake your own user agent? Something like commonsapi/1.0
I'm only faking it because with the default agent (whatever it is for PHP), requests often don't work on Mediawiki sites. Not sure what would happen if I make my own...
+// get file data via "normal" API +$ii_url = "http://commons.wikimedia.org/w/api.php?format=php&action=query&prop=...:" . $img ;
Needs an urlencode($img);
if ( $m == 'Quality images' ) {
- $titles['qualityimage'] = 1 ; // Just to make sure...
- continue ;
}
if ( substr ( $m , 0 , 19 ) == 'Pictures of the day' ) {
- if ( !isset ( $titles['potd'] ) ) $titles['potd'] = trim ( substr ( $m , 21 , 4 ) ) . "0000" ;
- continue ;
}
You can get this as well from the [[Commons:Machine readability]] system.
I already do. This is mostly a fallback system for pages that don't use {{Information}}, but are still quality or potd. Not sure how many of those are there (or if any), but so what...
Looks nice :) I would like to co-maintain this but unfortunately I already have too much work at my hands :( I'll probably be committing some occasional stuff to svn.
Cool, thanks.
Magnus