User talk:GrapeNuts

From Homestar Runner Wiki

(Difference between revisions)
Jump to: navigation, search
(tweak)
(Create filename redirects)
Line 10: Line 10:
You can check that off the list, Joey. I'm not gonna tough STUFF archives, and I got everything else, so I'd say it 's done. --{{User:ACupOfCoffee/sig}} 15:14, 26 October 2005 (UTC)
You can check that off the list, Joey. I'm not gonna tough STUFF archives, and I got everything else, so I'd say it 's done. --{{User:ACupOfCoffee/sig}} 15:14, 26 October 2005 (UTC)
 +
 +
== Create filename redirects ==
 +
 +
Create filename redirects to articles based on their filenames.
 +
<pre>#coding: iso-8859-1
 +
"""
 +
Created redirects to articles based on their respective
 +
toon's HTML filename.
 +
 +
Arguments understood by various bots:
 +
-lang: Choose your language - however, this bot probably is only
 +
      to be used on en:
 +
-putthrottle: Specify minimum number of seconds to wait between
 +
              edits
 +
 +
Specific arguments:
 +
-start:xxx Specify the place in the alphabet to start searching
 +
-force: Don't ask whether to create pages, just create them.
 +
 +
"""
 +
#
 +
# Adapted by Tom from us-states.py which is
 +
# (C) Andre Engels, 2004
 +
#
 +
# Distribute under the terms of the PSF license.
 +
#
 +
 +
import re,wikipedia,sys
 +
 +
def main():
 +
    start = '0'
 +
    force = False
 +
    msg = {'en':'Creating filename abbreviation redirect'
 +
          }
 +
 +
    abbrev = {
 +
'Marzipan\'s_Answering_Machine_Version_1': 'answer1.html',
 +
'Marzipan\'s_Answering_Machine_Version_2': 'answer2.html',
 +
'Marzipan\'s_Answering_Machine_Version_3': 'answer3.html',
 +
'Marzipan\'s_Answering_Machine_Version_4': 'answer4.html',
 +
'Marzipan\'s_Answering_Machine_Version_5': 'answer5.html',
 +
'Marzipan\'s_Answering_Machine_Version_6': 'answer6.html',
 +
'Marzipan\'s_Answering_Machine_Version_7': 'answer7.html',
 +
'Marzipan\'s_Answering_Machine_Version_8': 'answer8.html',
 +
'Marzipan\'s_Answering_Machine_Version_9': 'answer9.html',
 +
'Marzipan\'s_Answering_Machine_Version_10': 'answer10.html',
 +
'Marzipan\'s_Answering_Machine_Version_11': 'answer11.html',
 +
'Marzipan\'s_Answering_Machine_Version_12': 'answer12.html',
 +
'Sick_Day': 'sickday.html',
 +
'TrogdorCon_\'97': 'trogdorcon.html',
 +
'The_Li\'l_Brudder_Show': 'lilbrudder.html',
 +
'Peasant\'s_Quest_Movie_Trailer': 'filmstyle.html',
 +
'Peasant\'s_Quest_Preview': 'pqtrailer.html',
 +
'Experimental_Film': 'expfilm.html',
 +
'Senor_Mortgage': 'senormortgage.html',
 +
'Cheat_Commandos...O\'s': 'cheatcereal.html',
 +
'The_Cheatar': 'cheatar.html',
 +
'Cheat_Commandos': 'cheatcommando.html',
 +
'Mr._Shmallow': 'mrshmallow.html',
 +
'Ballad_of_the_Sneak': 'sneakvideo.html',
 +
'Lookin_at_a_Thing_in_a_Bag': 'whatsinthebag.html',
 +
'Arcade_Game': 'arcadegame.html',
 +
'20X6_vs._1936': '20x6vs1936.html',
 +
'The_System_is_Down': 'systemisdown.html',
 +
'Meet_Marshie': 'marshie.html',
 +
'The_Interview': 'interview.html',
 +
'Fluffy_Puff_Commercial': 'fluffypuff2.html',
 +
'Theme_Song_Video': 'video.html',
 +
'Kick_The_Can': 'old.html',
 +
'Strong_Bad_Sings': 'sbsings.html',
 +
'A_Folky_Tale': 'dumpingtontoon.html',
 +
'Cool_Things': 'coolthings.html',
 +
'Bug_in_Mouth_Disease': 'buginmouth.html',
 +
'Shopping_for_Danger': 'commandos3.html',
 +
'Strong_Bad_is_in_Jail_Cartoon': 'jailcartoon.html',
 +
'Parsnips_A-Plenty': 'parsnips.html',
 +
'Where\'s_The_Cheat?': 'whereis.html',
 +
'The_Luau': 'luau2.html',
 +
'A_Jorb_Well_Done': 'cantsayjob.html',
 +
'The_Reddest_Radish': 'radish.html',
 +
'In_Search_of_the_Yello_Dello': 'yellodellomenu.html',
 +
'The_King_of_Town': 'kingmenu.html',
 +
'Happy_Fireworks': 'fireworks.html',
 +
'Senorial_Day': 'senorialday.html',
 +
'HomestarRunner.com_PAY_PLUS!': 'payplus.html',
 +
'Homestar_Presents:_Presents': 'xmas04.html',
 +
'Snowglobe': 'xmas04_pq.html',
 +
'Halloween_Fairstival': 'ween04.html',
 +
'That_A_Ghost': 'oldtimeyween.html',
 +
'That_Time_of_Year': 'dween_kidsbook.html',
 +
'Decemberween_Sweet_Cuppin\'_Cakes': 'dween_cakes.html',
 +
'Decemberween_Teen_Girl_Squad': 'dween_tgs.html',
 +
'Seasonal_Sweaters': 'seasonalsweaters.html',
 +
'Under_Construction': 'underconstruction.html',
 +
'3_Times_Halloween_Funjob': 'ween03.html',
 +
'Fan_Costume_Commentary': 'costumes.html',
 +
'Malloween_Commercial': 'malloween.html',
 +
'Superbowl_Dealie': 'superbowl.html',
 +
'A_Decemberween_Pageant': 'xmas2002.html',
 +
'Pumpkin_Carve-nival': 'halloween2002.html',
 +
'The_Best_Decemberween_Ever': 'xmas2001.html',
 +
'Some_Stupid_Turkey': 'turkey.html',
 +
'The_House_That_Gave_Sucky_Treats': 'halloween2001.html',
 +
'A_Mother\'s_Day_Message': 'mother.html',
 +
'A_Holiday_Greeting': 'xmas.html',
 +
'Homestarloween_Party': 'homestarloween.html',
 +
'Biz_Cas_Fri_3': 'bizcasfri3.html',
 +
'Biz_Cas_Fri_2': 'bizcasfri2.html',
 +
'Biz_Cas_Fri_1': 'bizcasfri1.html',
 +
'Strong_Bad_vs._Little_Girl!': 'sbvslilgirl.html',
 +
'Homestar_vs._Little_Girl_2': 'puppetween.html',
 +
'Labor_Dabor': 'laborday.html',
 +
'Puppet_Jam:_Mission_Control': 'puppetjam4.html',
 +
'Puppet_Jam:_Vitamins/Celebrities': 'puppetjam3.html',
 +
'Puppet_Jam:_Tropical_Lazor_Beams': 'puppetjam2.html',
 +
'Puppet_Jam:_Bad_Jokes': 'puppetjam1.html',
 +
'Puppet_Time': 'puppettime.html',
 +
'Everybody_Knows_It': 'puppets.html',
 +
'Homestar_vs._Little_Girl': 'dween_puppet2.html',
 +
'Decemberween_Puppet_Style': 'dween_puppet1.html',
 +
'New_Boots': 'newboots.html',
 +
'Crazy_Cartoon': 'crazycartoon.html',
 +
'Everybody_to_the_Limit': 'fhqwhgads.html',
 +
'The_Cheat_Theme_Song': 'cheatvideo.html',
 +
'some_kinda_robot': 'sbemail1.html',
 +
'homsar': 'sbemail2.html',
 +
'butt_IQ': 'sbemail3.html',
 +
'homestar_hair': 'sbemail4.html',
 +
'making_out': 'sbemail5.html',
 +
'depressio': 'sbemail6.html',
 +
'halloweener': 'sbemail7.html',
 +
'brianrietta': 'sbemail8.html',
 +
'i_love_you': 'sbemail9.html',
 +
'trevor_the_vampire': 'sbemail10.html',
 +
'i_rule': 'sbemail11.html',
 +
'credit_card': 'sbemail12.html',
 +
'i_she_be': 'sbemail13.html',
 +
'duck_pond': 'sbemail14.html',
 +
'the_basics': 'sbemail15.html',
 +
'band_names': 'sbemail16.html',
 +
'studying': 'sbemail17.html',
 +
'stand-up': 'sbemail18.html',
 +
'tape-leg': 'sbemail19.html',
 +
'spring_cleaning': 'sbemail20.html',
 +
'cartoon': 'sbemail21.html',
 +
'sb_email_22': 'sbemail22.html',
 +
'little_animal': 'sbemail23.html',
 +
'the_bird': 'sbemail24.html',
 +
'super_powers': 'sbemail25.html',
 +
'CGNU': 'sbemail26.html',
 +
'3_Wishes': 'sbemail27.html',
 +
'1_step_ahead': 'sbemail28.html',
 +
'superhero_name': 'sbemail29.html',
 +
'12:00': 'sbemail30.html',
 +
'sugarbob': 'sbemail31.html',
 +
'flag_day': 'sbemail32.html',
 +
'gimmicks': 'sbemail33.html',
 +
'weird_dream': 'sbemail34.html',
 +
'sisters': 'sbemail35.html',
 +
'guitar': 'sbemail36.html',
 +
'dullard': 'sbemail37.html',
 +
'helium': 'sbemail38.html',
 +
'property_of_ones': 'sbemail39.html',
 +
'vacation': 'sbemail40.html',
 +
'invisibility': 'sbemail41.html',
 +
'action_figure': 'sbemail42.html',
 +
'little_questions': 'sbemail43.html',
 +
'lures_&_jigs': 'sbemail44.html',
 +
'techno': 'sbemail45.html',
 +
'your_friends': 'sbemail46.html',
 +
'new_hands': 'sbemail47.html',
 +
'ghosts': 'sbemail48.html',
 +
'theme_party': 'sbemail49.html',
 +
'50_emails': 'sbemail50.html',
 +
'website': 'sbemail51.html',
 +
'island': 'sbemail52.html',
 +
'comic': 'sbemail53.html',
 +
'morning_routine': 'sbemail54.html',
 +
'cheat_talk': 'sbemail55.html',
 +
'current_status': 'sbemail56.html',
 +
'japanese_cartoon': 'sbemail57.html',
 +
'dragon': 'sbemail58.html',
 +
'marzipan': 'sbemail59.html',
 +
'huttah!': 'sbemail60.html',
 +
'monster_truck': 'sbemail61.html',
 +
'interview': 'sbemail62.html',
 +
'fingers': 'sbemail63.html',
 +
'english_paper': 'sbemail64.html',
 +
'unused_emails': 'sbemail65.html',
 +
'the_show': 'sbemail66.html',
 +
'autobiography': 'sbemail67.html',
 +
'caper': 'sbemail68.html',
 +
'personal_favorites': 'sbemail69.html',
 +
'big_white_face': 'sbemail70.html',
 +
'2_emails': 'sbemail71.html',
 +
'crazy_cartoon': 'sbemail72.html',
 +
'mascot': 'sbemail73.html',
 +
'privileges': 'sbemail74.html',
 +
'funny': 'sbemail75.html',
 +
'sibbie': 'sbemail76.html',
 +
'suntan': 'sbemail77.html',
 +
'anything': 'sbemail78.html',
 +
'the_process': 'sbemail79.html',
 +
'stunt_double': 'sbemail80.html',
 +
'date': 'sbemail81.html',
 +
'impression': 'sbemail82.html',
 +
'labor_day': 'sbemail83.html',
 +
'kids\'_book': 'sbemail84.html',
 +
'2_years': 'sbemail85.html',
 +
'no_loafing': 'sbemail86.html',
 +
'mile': 'sbemail87.html',
 +
'couch_patch': 'sbemail88.html',
 +
'local_news': 'sbemail89.html',
 +
'colonization': 'sbemail90.html',
 +
'caffeine': 'sbemail91.html',
 +
'kind_of_cool': 'sbemail92.html',
 +
'army': 'sbemail93.html',
 +
'video_games': 'sbemail94.html',
 +
'the_bet': 'sbemail95.html',
 +
'lackey': 'sbemail96.html',
 +
'monument': 'sbemail97.html',
 +
'stupid_stuff': 'sbemail98.html',
 +
'different_town': 'sbemail99.html',
 +
'flashback': 'sbemailahundred.html',
 +
'car': 'sbemail101.html',
 +
'lunch_special': 'sbemail102.html',
 +
'haircut': 'sbemail103.html',
 +
'theme_park': 'sbemail104.html',
 +
'replacement': 'sbemail105.html',
 +
'dangeresque_3': 'sbemail106.html',
 +
'cheatday': 'sbemail107.html',
 +
'pom_pom': 'sbemail108.html',
 +
'crying': 'sbemail109.html',
 +
'for_kids': 'sbemail110.html',
 +
'other_days': 'sbemail111.html',
 +
'old_comics': 'sbemail112.html',
 +
'pizzaz': 'sbemail113.html',
 +
'the_facts': 'sbemail114.html',
 +
'time_capsule': 'sbemail115.html',
 +
'extra_plug': 'sbemail116.html',
 +
'montage': 'sbemail117.html',
 +
'virus': 'sbemail118.html',
 +
'animal': 'sbemail119.html',
 +
'radio': 'sbemail120.html',
 +
'part-time_job': 'sbemail121.html',
 +
'dreamail': 'sbemail122.html',
 +
'origins': 'sbemail123.html',
 +
'secret_recipes': 'sbemail124.html',
 +
'rock_opera': 'sbemail125.html',
 +
'best_thing': 'sbemail126.html',
 +
'long_pants': 'sbemail127.html',
 +
'rampage': 'sbemail128.html',
 +
'garage_sale': 'sbemail129.html',
 +
'do_over': 'sbemail130.html',
 +
'boring_(really)': 'sbemail131.html',
 +
'modeling': 'sbemail132.html',
 +
'bottom_10': 'sbemail133.html',
 +
'record_book': 'sbemail134.html',
 +
'lady...ing': 'sbemail135.html',
 +
'geddup_noise': 'sbemail136.html',
 +
'bedtime_story': 'sbemail137.html'
 +
        }
 +
 +
    for arg in sys.argv[1:]:
 +
        arg = wikipedia.argHandler(arg, 'greasemonkey-redirects')
 +
        if arg:
 +
            if arg.startswith('-start:'):
 +
                start = arg[7:]
 +
            elif arg == '-force':
 +
                force = True
 +
            else:
 +
                print('Warning: argument "%s" not understood; ignoring.')%arg
 +
 +
    mysite = wikipedia.getSite()
 +
    for p in mysite.allpages(start = start):
 +
        for sn in abbrev:
 +
            R=re.compile('[^[]]*' + '\%2C_' + sn)
 +
            for res in R.findall(p.urlname()):
 +
                pl=wikipedia.Page(mysite, p.urlname().replace(sn,abbrev[sn]))
 +
                # A bit hacking here - the real work is done in the 'except wikipedia.NoPage'
 +
                # part rather than the 'try'.
 +
                try:
 +
                    goal = pl.getRedirectTarget()
 +
                    if wikipedia.Page(mysite, goal):
 +
                        print("Not creating %s - redirect already exists.") % goal
 +
                    else:
 +
                        print("WARNING!!! %s already exists but redirects elsewhere!") % goal
 +
                except wikipedia.IsNotRedirectPage:
 +
                    print("WARNING!!! Page %s already exists and is not a redirect. Please check page!") % goal
 +
                except wikipedia.NoPage:
 +
                    change=''
 +
                    if p.isRedirectPage():
 +
                        p2 = wikipedia.Page(mysite, p.getRedirectTarget())
 +
                        print ('Note: goal page is redirect. Creating redirect to "%s" to avoid double redirect.')%p2.urlname().replace("%2C",",").replace("_"," ")
 +
                    else:
 +
                        p2 = p
 +
                    if force:
 +
                        change='y'
 +
                    else:
 +
                        while not change in ['y','n']:
 +
                            print ("Create redirect %s")%pl.urlname().replace("%2C",",").replace("_"," ")
 +
                            change = raw_input("(y/n)? ")
 +
                    if change=='y':
 +
                        text = '#REDIRECT [['+p2.urlname().replace("%2C",",").replace("_"," ")+']]'
 +
                        pl.put(text, comment = wikipedia.translate(mysite, msg), minorEdit = '0')
 +
 +
try:
 +
    main()
 +
except:
 +
    wikipedia.stopme()
 +
    raise
 +
else:
 +
    wikipedia.stopme()</pre>
 +
See [[User talk:Tom/Greasemonkey Script]] for details.[[User:Tom|<nowiki></nowiki>]]  --  [[User:Tom|Tom]] 01:03, 6 November 2005 (UTC)

Revision as of 01:03, 6 November 2005

Welcome to GrapeNuts' talk page.

Contents

Proposed Projects

Bold Colon

Yeah, my sig is fixed

You can check that off the list, Joey. I'm not gonna tough STUFF archives, and I got everything else, so I'd say it 's done. --— User:ACupOfCoffee@ 15:14, 26 October 2005 (UTC)

Create filename redirects

Create filename redirects to articles based on their filenames.

#coding: iso-8859-1
"""
Created redirects to articles based on their respective
toon's HTML filename.

Arguments understood by various bots:
-lang: Choose your language - however, this bot probably is only
       to be used on en:
-putthrottle: Specify minimum number of seconds to wait between
              edits

Specific arguments:
-start:xxx Specify the place in the alphabet to start searching
-force: Don't ask whether to create pages, just create them.

"""
#
# Adapted by Tom from us-states.py which is
# (C) Andre Engels, 2004
#
# Distribute under the terms of the PSF license.
#

import re,wikipedia,sys

def main():
    start = '0'
    force = False
    msg = {'en':'Creating filename abbreviation redirect'
           }

    abbrev = {
	'Marzipan\'s_Answering_Machine_Version_1': 'answer1.html',
	'Marzipan\'s_Answering_Machine_Version_2': 'answer2.html',
	'Marzipan\'s_Answering_Machine_Version_3': 'answer3.html',
	'Marzipan\'s_Answering_Machine_Version_4': 'answer4.html',
	'Marzipan\'s_Answering_Machine_Version_5': 'answer5.html',
	'Marzipan\'s_Answering_Machine_Version_6': 'answer6.html',
	'Marzipan\'s_Answering_Machine_Version_7': 'answer7.html',
	'Marzipan\'s_Answering_Machine_Version_8': 'answer8.html',
	'Marzipan\'s_Answering_Machine_Version_9': 'answer9.html',
	'Marzipan\'s_Answering_Machine_Version_10': 'answer10.html',
	'Marzipan\'s_Answering_Machine_Version_11': 'answer11.html',
	'Marzipan\'s_Answering_Machine_Version_12': 'answer12.html',
	'Sick_Day': 'sickday.html',
	'TrogdorCon_\'97': 'trogdorcon.html',
	'The_Li\'l_Brudder_Show': 'lilbrudder.html',
	'Peasant\'s_Quest_Movie_Trailer': 'filmstyle.html',
	'Peasant\'s_Quest_Preview': 'pqtrailer.html',
	'Experimental_Film': 'expfilm.html',
	'Senor_Mortgage': 'senormortgage.html',
	'Cheat_Commandos...O\'s': 'cheatcereal.html',
	'The_Cheatar': 'cheatar.html',
	'Cheat_Commandos': 'cheatcommando.html',
	'Mr._Shmallow': 'mrshmallow.html',
	'Ballad_of_the_Sneak': 'sneakvideo.html',
	'Lookin_at_a_Thing_in_a_Bag': 'whatsinthebag.html',
	'Arcade_Game': 'arcadegame.html',
	'20X6_vs._1936': '20x6vs1936.html',
	'The_System_is_Down': 'systemisdown.html',
	'Meet_Marshie': 'marshie.html',
	'The_Interview': 'interview.html',
	'Fluffy_Puff_Commercial': 'fluffypuff2.html',
	'Theme_Song_Video': 'video.html',
	'Kick_The_Can': 'old.html',
	'Strong_Bad_Sings': 'sbsings.html',
	'A_Folky_Tale': 'dumpingtontoon.html',
	'Cool_Things': 'coolthings.html',
	'Bug_in_Mouth_Disease': 'buginmouth.html',
	'Shopping_for_Danger': 'commandos3.html',
	'Strong_Bad_is_in_Jail_Cartoon': 'jailcartoon.html',
	'Parsnips_A-Plenty': 'parsnips.html',
	'Where\'s_The_Cheat?': 'whereis.html',
	'The_Luau': 'luau2.html',
	'A_Jorb_Well_Done': 'cantsayjob.html',
	'The_Reddest_Radish': 'radish.html',
	'In_Search_of_the_Yello_Dello': 'yellodellomenu.html',
	'The_King_of_Town': 'kingmenu.html',
	'Happy_Fireworks': 'fireworks.html',
	'Senorial_Day': 'senorialday.html',
	'HomestarRunner.com_PAY_PLUS!': 'payplus.html',
	'Homestar_Presents:_Presents': 'xmas04.html',
	'Snowglobe': 'xmas04_pq.html',
	'Halloween_Fairstival': 'ween04.html',
	'That_A_Ghost': 'oldtimeyween.html',
	'That_Time_of_Year': 'dween_kidsbook.html',
	'Decemberween_Sweet_Cuppin\'_Cakes': 'dween_cakes.html',
	'Decemberween_Teen_Girl_Squad': 'dween_tgs.html',
	'Seasonal_Sweaters': 'seasonalsweaters.html',
	'Under_Construction': 'underconstruction.html',
	'3_Times_Halloween_Funjob': 'ween03.html',
	'Fan_Costume_Commentary': 'costumes.html',
	'Malloween_Commercial': 'malloween.html',
	'Superbowl_Dealie': 'superbowl.html',
	'A_Decemberween_Pageant': 'xmas2002.html',
	'Pumpkin_Carve-nival': 'halloween2002.html',
	'The_Best_Decemberween_Ever': 'xmas2001.html',
	'Some_Stupid_Turkey': 'turkey.html',
	'The_House_That_Gave_Sucky_Treats': 'halloween2001.html',
	'A_Mother\'s_Day_Message': 'mother.html',
	'A_Holiday_Greeting': 'xmas.html',
	'Homestarloween_Party': 'homestarloween.html',
	'Biz_Cas_Fri_3': 'bizcasfri3.html',
	'Biz_Cas_Fri_2': 'bizcasfri2.html',
	'Biz_Cas_Fri_1': 'bizcasfri1.html',
	'Strong_Bad_vs._Little_Girl!': 'sbvslilgirl.html',
	'Homestar_vs._Little_Girl_2': 'puppetween.html',
	'Labor_Dabor': 'laborday.html',
	'Puppet_Jam:_Mission_Control': 'puppetjam4.html',
	'Puppet_Jam:_Vitamins/Celebrities': 'puppetjam3.html',
	'Puppet_Jam:_Tropical_Lazor_Beams': 'puppetjam2.html',
	'Puppet_Jam:_Bad_Jokes': 'puppetjam1.html',
	'Puppet_Time': 'puppettime.html',
	'Everybody_Knows_It': 'puppets.html',
	'Homestar_vs._Little_Girl': 'dween_puppet2.html',
	'Decemberween_Puppet_Style': 'dween_puppet1.html',
	'New_Boots': 'newboots.html',
	'Crazy_Cartoon': 'crazycartoon.html',
	'Everybody_to_the_Limit': 'fhqwhgads.html',
	'The_Cheat_Theme_Song': 'cheatvideo.html',
	'some_kinda_robot': 'sbemail1.html',
	'homsar': 'sbemail2.html',
	'butt_IQ': 'sbemail3.html',
	'homestar_hair': 'sbemail4.html',
	'making_out': 'sbemail5.html',
	'depressio': 'sbemail6.html',
	'halloweener': 'sbemail7.html',
	'brianrietta': 'sbemail8.html',
	'i_love_you': 'sbemail9.html',
	'trevor_the_vampire': 'sbemail10.html',
	'i_rule': 'sbemail11.html',
	'credit_card': 'sbemail12.html',
	'i_she_be': 'sbemail13.html',
	'duck_pond': 'sbemail14.html',
	'the_basics': 'sbemail15.html',
	'band_names': 'sbemail16.html',
	'studying': 'sbemail17.html',
	'stand-up': 'sbemail18.html',
	'tape-leg': 'sbemail19.html',
	'spring_cleaning': 'sbemail20.html',
	'cartoon': 'sbemail21.html',
	'sb_email_22': 'sbemail22.html',
	'little_animal': 'sbemail23.html',
	'the_bird': 'sbemail24.html',
	'super_powers': 'sbemail25.html',
	'CGNU': 'sbemail26.html',
	'3_Wishes': 'sbemail27.html',
	'1_step_ahead': 'sbemail28.html',
	'superhero_name': 'sbemail29.html',
	'12:00': 'sbemail30.html',
	'sugarbob': 'sbemail31.html',
	'flag_day': 'sbemail32.html',
	'gimmicks': 'sbemail33.html',
	'weird_dream': 'sbemail34.html',
	'sisters': 'sbemail35.html',
	'guitar': 'sbemail36.html',
	'dullard': 'sbemail37.html',
	'helium': 'sbemail38.html',
	'property_of_ones': 'sbemail39.html',
	'vacation': 'sbemail40.html',
	'invisibility': 'sbemail41.html',
	'action_figure': 'sbemail42.html',
	'little_questions': 'sbemail43.html',
	'lures_&_jigs': 'sbemail44.html',
	'techno': 'sbemail45.html',
	'your_friends': 'sbemail46.html',
	'new_hands': 'sbemail47.html',
	'ghosts': 'sbemail48.html',
	'theme_party': 'sbemail49.html',
	'50_emails': 'sbemail50.html',
	'website': 'sbemail51.html',
	'island': 'sbemail52.html',
	'comic': 'sbemail53.html',
	'morning_routine': 'sbemail54.html',
	'cheat_talk': 'sbemail55.html',
	'current_status': 'sbemail56.html',
	'japanese_cartoon': 'sbemail57.html',
	'dragon': 'sbemail58.html',
	'marzipan': 'sbemail59.html',
	'huttah!': 'sbemail60.html',
	'monster_truck': 'sbemail61.html',
	'interview': 'sbemail62.html',
	'fingers': 'sbemail63.html',
	'english_paper': 'sbemail64.html',
	'unused_emails': 'sbemail65.html',
	'the_show': 'sbemail66.html',
	'autobiography': 'sbemail67.html',
	'caper': 'sbemail68.html',
	'personal_favorites': 'sbemail69.html',
	'big_white_face': 'sbemail70.html',
	'2_emails': 'sbemail71.html',
	'crazy_cartoon': 'sbemail72.html',
	'mascot': 'sbemail73.html',
	'privileges': 'sbemail74.html',
	'funny': 'sbemail75.html',
	'sibbie': 'sbemail76.html',
	'suntan': 'sbemail77.html',
	'anything': 'sbemail78.html',
	'the_process': 'sbemail79.html',
	'stunt_double': 'sbemail80.html',
	'date': 'sbemail81.html',
	'impression': 'sbemail82.html',
	'labor_day': 'sbemail83.html',
	'kids\'_book': 'sbemail84.html',
	'2_years': 'sbemail85.html',
	'no_loafing': 'sbemail86.html',
	'mile': 'sbemail87.html',
	'couch_patch': 'sbemail88.html',
	'local_news': 'sbemail89.html',
	'colonization': 'sbemail90.html',
	'caffeine': 'sbemail91.html',
	'kind_of_cool': 'sbemail92.html',
	'army': 'sbemail93.html',
	'video_games': 'sbemail94.html',
	'the_bet': 'sbemail95.html',
	'lackey': 'sbemail96.html',
	'monument': 'sbemail97.html',
	'stupid_stuff': 'sbemail98.html',
	'different_town': 'sbemail99.html',
	'flashback': 'sbemailahundred.html',
	'car': 'sbemail101.html',
	'lunch_special': 'sbemail102.html',
	'haircut': 'sbemail103.html',
	'theme_park': 'sbemail104.html',
	'replacement': 'sbemail105.html',
	'dangeresque_3': 'sbemail106.html',
	'cheatday': 'sbemail107.html',
	'pom_pom': 'sbemail108.html',
	'crying': 'sbemail109.html',
	'for_kids': 'sbemail110.html',
	'other_days': 'sbemail111.html',
	'old_comics': 'sbemail112.html',
	'pizzaz': 'sbemail113.html',
	'the_facts': 'sbemail114.html',
	'time_capsule': 'sbemail115.html',
	'extra_plug': 'sbemail116.html',
	'montage': 'sbemail117.html',
	'virus': 'sbemail118.html',
	'animal': 'sbemail119.html',
	'radio': 'sbemail120.html',
	'part-time_job': 'sbemail121.html',
	'dreamail': 'sbemail122.html',
	'origins': 'sbemail123.html',
	'secret_recipes': 'sbemail124.html',
	'rock_opera': 'sbemail125.html',
	'best_thing': 'sbemail126.html',
	'long_pants': 'sbemail127.html',
	'rampage': 'sbemail128.html',
	'garage_sale': 'sbemail129.html',
	'do_over': 'sbemail130.html',
	'boring_(really)': 'sbemail131.html',
	'modeling': 'sbemail132.html',
	'bottom_10': 'sbemail133.html',
	'record_book': 'sbemail134.html',
	'lady...ing': 'sbemail135.html',
	'geddup_noise': 'sbemail136.html',
	'bedtime_story': 'sbemail137.html'
        }

    for arg in sys.argv[1:]:
        arg = wikipedia.argHandler(arg, 'greasemonkey-redirects')
        if arg:
            if arg.startswith('-start:'):
                start = arg[7:]
            elif arg == '-force':
                force = True
            else:
                print('Warning: argument "%s" not understood; ignoring.')%arg

    mysite = wikipedia.getSite()
    for p in mysite.allpages(start = start):
        for sn in abbrev:
            R=re.compile('[^[]]*' + '\%2C_' + sn)
            for res in R.findall(p.urlname()):
                pl=wikipedia.Page(mysite, p.urlname().replace(sn,abbrev[sn]))
                # A bit hacking here - the real work is done in the 'except wikipedia.NoPage'
                # part rather than the 'try'.
                try:
                    goal = pl.getRedirectTarget()
                    if wikipedia.Page(mysite, goal):
                        print("Not creating %s - redirect already exists.") % goal
                    else:
                        print("WARNING!!! %s already exists but redirects elsewhere!") % goal
                except wikipedia.IsNotRedirectPage:
                    print("WARNING!!! Page %s already exists and is not a redirect. Please check page!") % goal
                except wikipedia.NoPage:
                    change=''
                    if p.isRedirectPage():
                        p2 = wikipedia.Page(mysite, p.getRedirectTarget())
                        print ('Note: goal page is redirect. Creating redirect to "%s" to avoid double redirect.')%p2.urlname().replace("%2C",",").replace("_"," ")
                    else:
                        p2 = p
                    if force:
                        change='y'
                    else:
                        while not change in ['y','n']:
                            print ("Create redirect %s")%pl.urlname().replace("%2C",",").replace("_"," ")
                            change = raw_input("(y/n)? ")
                    if change=='y':
                        text = '#REDIRECT [['+p2.urlname().replace("%2C",",").replace("_"," ")+']]'
                        pl.put(text, comment = wikipedia.translate(mysite, msg), minorEdit = '0')

try:
    main()
except:
    wikipedia.stopme()
    raise
else:
    wikipedia.stopme()

See User talk:Tom/Greasemonkey Script for details. -- Tom 01:03, 6 November 2005 (UTC)

Personal tools