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
+// 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.
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.
Bryan
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
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...
It will work. Actually, it's semi-officially requested/recommended that you use your own descriptive user agent string, including some means to learn more about the tool and/or contact you -- or selectively block it if things go wrong. And it does work, I use it for my own stuff.
General request to ALL bot and script makers, for any purpose: Please DO NOT FAKE UA STRINGS! Please set your own, descriptive ones! This is a question of good netizenship (as in "follow the spec" and "be cooperative").
Thank you -- Daniel
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Daniel Kinzler wrote:
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...
It will work. Actually, it's semi-officially requested/recommended that you use your own descriptive user agent string, including some means to learn more about the tool and/or contact you -- or selectively block it if things go wrong. And it does work, I use it for my own stuff.
General request to ALL bot and script makers, for any purpose: Please DO NOT FAKE UA STRINGS! Please set your own, descriptive ones! This is a question of good netizenship (as in "follow the spec" and "be cooperative").
Basically, if we catch you faking a browser UA we will block you without mercy. :)
Default UAs for various standard libraries are unfortunately blocked due to past abuse. We strongly recommend using a specific user-agent string which includes your software's name and some sort of contact information... a URL or email address helps... so that problematic bots can be tracked down and the problem worked out.
- -- brion vibber (brion @ wikimedia.org)