Fix for alternatehistory.com changing threadmark date attr.

This commit is contained in:
Jim Miller 2025-04-28 20:26:07 -05:00
parent bd49f8e8fa
commit 90ecb63be4

View file

@ -666,11 +666,18 @@ class BaseXenForo2ForumAdapter(BaseSiteAdapter):
return threadmarks
def make_date(self,parenttag):
datestr=None
try:
datetag = parenttag.find('time')
# logger.debug(datetag)
# not paying any attention to TZ issues.
return datetime.fromtimestamp(float(datetag['data-time']))
## AH has changed to data-timestamp, which others don't
## have (yet) and is honestly more accurately named. Impl
## for all in case they add it.
if datetag.has_attr('data-timestamp'):
floatdt = float(datetag['data-timestamp'])
elif datetag.has_attr('data-time'):
floatdt = float(datetag['data-time'])
return datetime.fromtimestamp(floatdt)
except:
# logger.warning('No date found in %s'%parenttag,exc_info=True)
return None