mirror of
				https://github.com/Mikaela/Limnoria.git
				synced 2025-10-31 15:47:25 +01:00 
			
		
		
		
	Web: Display the target domain in snarfer. Re-implements pull request GH-523.
This commit is contained in:
		
							parent
							
								
									bdec243909
								
							
						
					
					
						commit
						11d8f4655b
					
				| @ -131,11 +131,13 @@ class Web(callbacks.PluginRegexp): | ||||
|                 return | ||||
|             try: | ||||
|                 size = conf.supybot.protocols.http.peekSize() | ||||
|                 text = utils.web.getUrl(url, size=size) | ||||
|             except utils.web.Error, e: | ||||
|                 fd = utils.web.getUrlFd(url) | ||||
|                 text = fd.read(size) | ||||
|                 fd.close() | ||||
|             except socket.timeout, e: | ||||
|                 self.log.info('Couldn\'t snarf title of %u: %s.', url, e) | ||||
|                 if self.registryValue('snarferReportIOExceptions', channel): | ||||
|                      irc.reply(url+" : "+utils.web.strError(e), prefixNick=False) | ||||
|                      irc.reply(url+" : "+utils.web.TIMED_OUT, prefixNick=False) | ||||
|                 return | ||||
|             try: | ||||
|                 text = text.decode(utils.web.getEncoding(text) or 'utf8', | ||||
| @ -149,7 +151,7 @@ class Web(callbacks.PluginRegexp): | ||||
|                 self.log.debug('Encountered a problem parsing %u.  Title may ' | ||||
|                                'already be set, though', url) | ||||
|             if parser.title: | ||||
|                 domain = utils.web.getDomain(url) | ||||
|                 domain = utils.web.getDomain(fd.geturl()) | ||||
|                 title = utils.web.htmlToText(parser.title.strip()) | ||||
|                 if sys.version_info[0] < 3: | ||||
|                     if isinstance(title, unicode): | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Valentin Lorentz
						Valentin Lorentz