diff --git a/fanficfare/adapters/adapter_alternatehistorycom.py b/fanficfare/adapters/adapter_alternatehistorycom.py index c3d13649..a51d5020 100644 --- a/fanficfare/adapters/adapter_alternatehistorycom.py +++ b/fanficfare/adapters/adapter_alternatehistorycom.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright 2018 FanFicFare team +# Copyright 2020 FanFicFare team # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -16,15 +16,18 @@ # from __future__ import absolute_import -from .adapter_forumquestionablequestingcom import QuestionablequestingComAdapter +from .base_xenforo2forum_adapter import BaseXenForo2ForumAdapter + +import logging +logger = logging.getLogger(__name__) def getClass(): return WWWAlternatehistoryComAdapter -class WWWAlternatehistoryComAdapter(QuestionablequestingComAdapter): +class WWWAlternatehistoryComAdapter(BaseXenForo2ForumAdapter): def __init__(self, config, url): - QuestionablequestingComAdapter.__init__(self, config, url) + BaseXenForo2ForumAdapter.__init__(self, config, url) # Each adapter needs to have a unique site abbreviation. self.story.setMetadata('siteabbrev','ah') @@ -39,3 +42,6 @@ class WWWAlternatehistoryComAdapter(QuestionablequestingComAdapter): # in case it needs more than just site/ return 'https://' + cls.getSiteDomain() + '/forum' + def get_threadmarks_top(self,souptag): + return souptag.find('div',{'class':'block-outer-opposite--threadmarks'}) + diff --git a/fanficfare/adapters/base_xenforoforum_adapter.py b/fanficfare/adapters/base_xenforoforum_adapter.py index 22849059..8d1f1eea 100644 --- a/fanficfare/adapters/base_xenforoforum_adapter.py +++ b/fanficfare/adapters/base_xenforoforum_adapter.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright 2019 FanFicFare team +# Copyright 2020 FanFicFare team # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -280,10 +280,12 @@ class BaseXenForoForumAdapter(BaseSiteAdapter): if tmcat_name == 'Apocrypha' and self.getConfig('apocrypha_to_omake'): tmcat_name = 'Omake' - if 'http' not in threadmarksa['href']: - href = self.getURLPrefix()+'/'+threadmarksa['href'] - else: + if 'http' in threadmarksa['href']: href = threadmarksa['href'] + elif threadmarksa['href'].startswith('/'): + href = 'https://'+self.getSiteDomain()+threadmarksa['href'] + else: + href = self.getURLPrefix()+'/'+threadmarksa['href'] threadmarkgroups[tmcat_name]=self.fetch_threadmarks(href, tmcat_name, tmcat_num)