コード例 #1
0
ファイル: OrphanPage.py プロジェクト: jrcourtois/dickensbot
	def getFrenchPages(self):
		self.itlPages = []
		for l in self.itlModels:
			for p in self.itlModels[l]:
				self.itlPages.append(ItlPage(l,p['title'],""))
		self.pages = {}
		for l in self.itlLinks:
			self.pages[l] = []
			for p in self.itlLinks[l]:
				t = Tools.getFrenchPage(Site.getKnownSite(l),p['title'])
				if t: 
					self.pages[l].append(t)
コード例 #2
0
ファイル: ModelPage.py プロジェクト: jrcourtois/dickensbot
	def __getTranslatedLinks(self):
		params = {'action':'query', 'prop':'langlinks'}
		self.foundLink = 0
		translatedLinks = {}
		self.frenchLinks = []
		for page in self.getLinks():
			p = Tools.getFrenchPage(self.site,page)
			key = page
			#translatedLinks[key] = "{{lien|trad="+page+u"|lang="+self.lg+"}}"
			if p:
				translatedLinks[key] =   p.title
				self.frenchLinks.append(p)
		print "Found links : "+ str(len(self.frenchLinks)) + "/" + str(len(self.getLinks())) + " for " + self.title.encode("utf8")
		return translatedLinks