Ejemplo n.º 1
0
 def __init__(self, username, password):
     """
     Initializing!~
     """
     mwhair.site('http://runescape.wikia.com/api.php')
     mwhair.login(username, password)
     self.site = "http://webcitation.org/archive"
     self.params = {'email':'*****@*****.**', 'returnxml':'true'}
     self.cite_templates = ['citedevblog', 'citedevdiary', 'citeforum',
     'citegodletter', 'citelore', 'citenews', 'citenpc',
     'citepoll', 'citepostbag', 'citesupport', 'citegeneral',
     'citepub', 'plaincitedevblog', 'plaincitedevdiary', 'plainciteforum',
     'plaincitegodletter', 'plaincitelore', 'plaincitenews', 'plaincitenpc',
     'plaincitepoll', 'plaincitepostbag']
     self.cj = cookielib.CookieJar()
     self.opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(self.cj))
     self.opener.add_headers = {('User-Agent','Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_5)' \
                                'AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.64')}
     self.cite_template = '{{CiteGeneral|url=%s|title=%s|' \
                          'accessdate=%s|archiveurl=%s|archivedate=%s}}'
     self.plain_cite_template = '{{PlainCiteGeneral|url=%s|title=%s|' \
                                'accessdate=%s|archiveurl=%s|archivedate=%s}}'
Ejemplo n.º 2
0
					if template.name is 'Multiple issues' or 'multiple issues' or 'Article issues' or 'Articleissues' or 'Issues' or 'MI' or 'mi' or 'Mi' or 'Multiple' or 'Multiple Issues' or 'Multipleissues':
						if template.has_param('dead end'):
								template.remove('dead end')
								if links <= 4:
									text = '{{subst:dated|Underlinked}}\n' + text
						else:
							try:
								for itemplate in template.get(1).value.filter_templates():
									if itemplate.name == 'Dead end' or 'dead end' or 'DEP' or 'dep' or 'DEp' or 'DeP' or 'Dead end page' or 'dead end page' or 'dead-end' or 'Dead-end' or 'Dead-End' or 'Deadend':
										text.remove(itemplate,'')
										if links <= 4:
											text = '{{subst:dated|Underlinked}}\n' + text
							except:
								pass
					elif template.name is 'Dead end' or 'dead end' or 'DEP' or 'dep' or 'DEp' or 'DeP' or 'Dead end page' or 'dead end page' or 'dead-end' or 'deadend' or 'Dead-end' or 'Deadend':
						text.replace(template,'')
				raw_input('Press enter')
				save(title,text)
def save(title,text):
	mwhair.save(title,text=text,summary='Removing dead end tag as not a valid dead end page',minor=True)
def pagelinks(title):
	return mwhair.links(title,namespace='0')
def main():
	pages = getpages()
	for page in pages:
		remove(page)
		time.sleep(1)
if __name__ == '__main__':
	mwhair.site('http://en.wikipedia.org/w/api.php')
	mwhair.login('HairBot','password')
	main()