mirror of
				https://github.com/searxng/searxng.git
				synced 2025-11-04 03:27:06 -05:00 
			
		
		
		
	[fix] reuters: published date not parsed correctly in some cases
FIxes publishedDate format in reuters engine to encompass ISO 8601 times both with and without milliseconds.
Why is this change important?
Previously, the engine would sometimes fail saying:
2025-08-12 21:13:23,091 ERROR:searx.engines.reuters: exception : time data '2024-04-15T19:08:30.833Z' does not match format '%Y-%m-%dT%H:%M:%SZ'
Traceback (most recent call last):
...
  File "/usr/local/searxng/searx/engines/reuters.py", line 87, in response
    publishedDate=datetime.strptime(result["display_time"], "%Y-%m-%dT%H:%M:%SZ"),
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
Note that most queries seem to work with Reuters, but there are some results that have the additional milliseconds and fail. Regardless, the change is backwards compatible as both the formats (with and without the ms) should now parse correctly.
			
			
This commit is contained in:
		
							parent
							
								
									792ec2afea
								
							
						
					
					
						commit
						b606103352
					
				@ -84,7 +84,7 @@ def response(resp) -> EngineResults:
 | 
				
			|||||||
                content=result["description"],
 | 
					                content=result["description"],
 | 
				
			||||||
                thumbnail=result.get("thumbnail", {}).get("url", ""),
 | 
					                thumbnail=result.get("thumbnail", {}).get("url", ""),
 | 
				
			||||||
                metadata=result.get("kicker", {}).get("name"),
 | 
					                metadata=result.get("kicker", {}).get("name"),
 | 
				
			||||||
                publishedDate=datetime.strptime(result["display_time"], "%Y-%m-%dT%H:%M:%SZ"),
 | 
					                publishedDate=datetime.fromisoformat(result["display_time"]),
 | 
				
			||||||
            )
 | 
					            )
 | 
				
			||||||
        )
 | 
					        )
 | 
				
			||||||
    return res
 | 
					    return res
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user