Handle more errors
This commit is contained in:
		
							
								
								
									
										8
									
								
								morss
									
									
									
									
									
								
							
							
						
						
									
										8
									
								
								morss
									
									
									
									
									
								
							@@ -32,6 +32,7 @@ for item in items:
 | 
			
		||||
	log(link)
 | 
			
		||||
	
 | 
			
		||||
	cached = cache + "/" + str(hash(link))
 | 
			
		||||
	log(cached)
 | 
			
		||||
	
 | 
			
		||||
	if os.path.exists(cached):
 | 
			
		||||
		log("cached")
 | 
			
		||||
@@ -43,10 +44,17 @@ for item in items:
 | 
			
		||||
			match =	html.xpath(node)
 | 
			
		||||
		
 | 
			
		||||
			if len(match):
 | 
			
		||||
				try:
 | 
			
		||||
					text =	etree.tostring(match[0])
 | 
			
		||||
					log("ok txt")
 | 
			
		||||
				except etree.SerialisationError:
 | 
			
		||||
					log('serialisation')
 | 
			
		||||
					continue
 | 
			
		||||
				try:
 | 
			
		||||
					desc.text = text
 | 
			
		||||
					open(cached, 'w').write(text)
 | 
			
		||||
				except ValueError:
 | 
			
		||||
					log('error')
 | 
			
		||||
			else:
 | 
			
		||||
				log("no match")
 | 
			
		||||
		
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user