User:Ryos/Watchlist RSS feeder

''This code is a modified version of Sylvain Schmitz's PHP RSS feed. His code and my changes are both released under the GFDL.''

I wanted an RSS feed of my watchlist almost immediately after joining Wikipedia. Unfortunately, the Wikipedia software doesn't support that feature. It seems that many wikipedians have been hacking away at the problem, but none of the solutions on that page worked for me. Sylvain Schmitz's was close, but I didn't want to have to post it to a (public) webserver (and I don't speak french). So, I started hacking away at Sylvain's code to see if I could make it do what I want. This is the result; may you find it useful.

What you'll need to make it work

 * 1) An RSS reader that has the ability to subscribe to scripts on the local machine. The only reader I know of that can do this is NetNewsWire, and it's Mac only.
 * 2) An installation of PHP 4.3.0 or later, properly configured to run command-line PHP scripts. Mac OS X comes so configured out of the box; I don't know how to do it on Windows (see the PHP manual).
 * 3) There is no step 3.

How to make it work

 * 1) Copy the code below to a text file and name it with a .php extension. When saving, keep in mind that the script saves a cookie file in the same directory.
 * 2) Configure the script. Set the following variables below:
 * 3) $wp_name = 'yourname';
 * 4) $wp_password = 'yourpass';
 * 5) $wp_tmz = 'your timezone offset from GMT'; //ex: -06:00 (that's my zone)
 * 6) $script_name = "the name you gave the script.php"; //This is used to name the cookie
 * 7) Make the script executable. To do this, open the terminal and type "chmod +x " (without the quotes). Then, drag the script file to the terminal window and press return.
 * 8) Subscribe to the script in NetNewsWire. Make sure to change the script type from "Applescript" to "Shell Script".

Known issues

 * 1) As of this writing, the parsing is somewhat broken. This is no doubt due to changes to the page structure made since the script was written. The script still mostly works, it just occasionally creates items with bad links and/or the wrong information. Unfortunately, I'm pretty busy these days and not very motivated to fix this script. If you fix it please post the updated version. Sorry, and thanks. ryos 07:35, 6 November 2007 (UTC)
 * 2) Linking to subpages (this page you're reading is a subpage) is broken due to the / character being urlencoded to %2F
 * 3) It probably won't work for non-english wikis. I say this because I had to make some changes to the parsing code from Silvain Schmitz's french-localized version in order to get it to work with en.wikipedia.org.
 * 4) I've found that NetNewsWire does not pick up edits to articles that have appeared in the feed before and remain cached by the application. There are two ways to work around this:
 * 5) You could enable the NNW preference to highlight differences to updated articles, or
 * 6) You could get info on your subscription, set it to use special persistence settings, and set items to disappear from the feed after 0 days. This is my preferred option.
 * I suppose that it may be possible to modify the feed such that these workarounds are not necessary, but frankly I know nothing about RSS feeds; I was able to modify Sylvain's code, but that's the extent of it.

Wishlist
If you have the time, ability, and inclination to add any of these (or an idea of your own), please do. It's open source, after all.


 * 1) Configuration via command-line arguments. This is actually implemented, but commented out because I couldn't get it to work with NetNewsWire, and I don't know why.
 * 2) Automatically get timezone with an Applescript wrapper. Not sure if possible, but it should be.
 * 3) Ability to grab watchlists from more than one wikimedia project, and built-in localizations to them all. Perhaps just the localized versions will do, since any newsreader worth its salt can aggregate multiple subscriptions into one.