diff --git a/fanficfare/adapters/adapter_fimfictionnet.py b/fanficfare/adapters/adapter_fimfictionnet.py index 341d9bd0..9383b2d7 100644 --- a/fanficfare/adapters/adapter_fimfictionnet.py +++ b/fanficfare/adapters/adapter_fimfictionnet.py @@ -314,7 +314,14 @@ class FimFictionNetSiteAdapter(BaseSiteAdapter): span = listItems[1].find('span',{'data-time':re.compile(r'^\d+$')}) ## Jun 27th, 2015 ## No timezone adjustment is done. - lastLogin = datetime.fromtimestamp(float(span['data-time'])) + if span != None: + lastLogin = datetime.fromtimestamp(float(span['data-time'])) + ## Sometimes, for reasons that are unclear, data-time is not present. Parse the date out of the title instead. + else: + span = listItems[1].find('span', title=True) + loginRegex = re.search('([a-zA-Z ]+)([0-9]+)(th of|nd of|rd of)([a-zA-Z ]+[0-9]+)', span['title']) + loginString = loginRegex.group(2) + loginRegex.group(4) + lastLogin = datetime.strptime(loginString, "%d %B %Y") self.story.setMetadata("authorLastLogin", lastLogin) def ordinal_date_string_to_date(self, datestring):