Update adapter_alternatehistorycom for XenForo2. Issue #457

This commit is contained in:
Jim Miller 2020-01-07 12:51:10 -06:00
parent 1b543780a8
commit 49a5536c51
2 changed files with 16 additions and 8 deletions

View file

@ -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'})

View file

@ -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)