User talk:He!ko/Signpost

import urllib import json
 * 1) !/usr/bin/env python

api_url = "http://en.wikipedia.org/w/api.php"

def create_book(data): for l in data.split('\n'): if l.startswith('*'):           l=l.replace('[[',)            l=l.replace(,)            l = l.strip[1:]            link, name  = l.split('|')             url = api_url +  '?action=query&format=json&prop=revisions&rvprop=content&titles=' + link # FIXME            res = json.loads(urllib.urlopen(url).read)            content = res['query']['pages'].values[0]['revisions'][0]['*']            for l in content.split('\n'):                if l.startswith('==='):                    print ';' + l.replace('===',).encode('utf8')                elif l.startswith(':'):                    print l.encode('utf8') if __name__ == '__main__':    """    List of Sigppost Books (not articles!) can be found here:    http://en.wikipedia.org/wiki/Book:Wikipedia_Signpost     Action:     Copy and paste a year (source) below.    Software:       * parses below      * replaces the listed books with the transcluded articles (adding chapters)      * outputs the stuff     """    create_book("""
 * January
 * 3 January 2009
 * 10 January 2009
 * 17 January 2009
 * 24 January 2009
 * 31 January 2009


 * February
 * 8 February 2009
 * 16 February 2009
 * 23 February 2009


 * March
 * 2 March 2009
 * 9 March 2009
 * 16 March 2009
 * 23 March 2009
 * 30 March 2009


 * April
 * 6 April 2009
 * 13 April 2009
 * 20 April 2009
 * 27 April 2009


 * May
 * 4 May 2009
 * 11 May 2009
 * 18 May 2009
 * 25 May 2009


 * June
 * 1 June 2009
 * 8 June 2009
 * 15 June 2009
 * 22 June 2009
 * 29 June 2009


 * July
 * 6 July 2009
 * 13 July 2009
 * 20 July 2009
 * 27 July 2009


 * August
 * 3 August 2009
 * 10 August 2009
 * 17 August 2009
 * 24 August 2009
 * 31 August 2009


 * September
 * 7 September 2009
 * 14 September 2009
 * 21 September 2009
 * 28 September 2009


 * October
 * 5 October 2009
 * 12 October 2009
 * 19 October 2009
 * 26 October 2009


 * November
 * 2 November 2009
 * 9 November 2009
 * 16 November 2009
 * 23 November 2009
 * 30 November 2009

""")
 * December
 * 7 December 2009
 * 14 December 2009
 * 21 December 2009
 * 28 December 2009