diff --git a/calibre-plugin/plugin-defaults.ini b/calibre-plugin/plugin-defaults.ini index a248d4ee..02b11d7b 100644 --- a/calibre-plugin/plugin-defaults.ini +++ b/calibre-plugin/plugin-defaults.ini @@ -1589,6 +1589,19 @@ extra_titlepage_entries:eroticatags,disclaimer #username:YourName #password:yourpassword +[althistory.com] +## Note this is NOT the same as www.alternatehistory.com +## see [base_xenforoforum] + +## Some sites require login (or login for some rated stories) The +## program can prompt you, or you can save it in config. In +## commandline version, this should go in your personal.ini, not +## defaults.ini. +## NOTE: You will probably need to have recently logged in using your +## browser to solve a captcha before this will work in FFF. +#username:YourName +#password:yourpassword + [archiveofourown.org] ## This is a OTW-archive site. ## Some sites require login (or login for some rated stories) The @@ -3401,6 +3414,7 @@ slow_down_sleep_time:2 #datechapter_format:%%Y-%%m-%%d [www.alternatehistory.com] +## Note this is NOT the same as althistory.com ## see [base_xenforoforum] ## Some sites require login (or login for some rated stories) The diff --git a/fanficfare/adapters/__init__.py b/fanficfare/adapters/__init__.py index b8bfc32c..47b8bfb6 100644 --- a/fanficfare/adapters/__init__.py +++ b/fanficfare/adapters/__init__.py @@ -143,6 +143,7 @@ from . import adapter_touchfluffytail from . import adapter_spiritfanfictioncom from . import adapter_superlove from . import adapter_cfaa +from . import adapter_althistorycom ## This bit of complexity allows adapters to be added by just adding ## importing. It eliminates the long if/else clauses we used to need diff --git a/fanficfare/adapters/adapter_althistorycom.py b/fanficfare/adapters/adapter_althistorycom.py new file mode 100644 index 00000000..00fced8e --- /dev/null +++ b/fanficfare/adapters/adapter_althistorycom.py @@ -0,0 +1,40 @@ +# -*- coding: utf-8 -*- + +# Copyright 2026 FanFicFare team +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +from __future__ import absolute_import +import re + +from .base_xenforo2forum_adapter import BaseXenForo2ForumAdapter + +def getClass(): + return AltHistoryComAdapter + +## NOTE: This is a different site than www.alternatehistory.com. + +class AltHistoryComAdapter(BaseXenForo2ForumAdapter): + + def __init__(self, config, url): + BaseXenForo2ForumAdapter.__init__(self, config, url) + + # Each adapter needs to have a unique site abbreviation. + self.story.setMetadata('siteabbrev','ahc') + + @staticmethod # must be @staticmethod, don't remove it. + def getSiteDomain(): + # The site domain. Does have www here, if it uses it. + return 'althistory.com' + diff --git a/fanficfare/adapters/base_xenforo2forum_adapter.py b/fanficfare/adapters/base_xenforo2forum_adapter.py index 68218baa..a4a57e5d 100644 --- a/fanficfare/adapters/base_xenforo2forum_adapter.py +++ b/fanficfare/adapters/base_xenforo2forum_adapter.py @@ -842,17 +842,23 @@ class BaseXenForo2ForumAdapter(BaseSiteAdapter): 'Time period':'timeperiodtags', } for tag in self.get_forumtags(topsoup): + # logger.debug(tag) + tagname = None tagcat = tag.select_one("i") + if tagcat and tagcat.has_attr('title'): + tagname = tagmap.get(tagcat['title'],None) + tagtitle = tag.select_one('title') + # logger.debug(tagtitle) + if tagtitle: + tagname = tagmap.get(stripHTML(tagtitle),None) + tagtitle.decompose() + tstr = stripHTML(tag) if self.getConfig('capitalize_forumtags'): tstr = title(tstr) - if tagcat: - tagname = tagmap.get(tagcat['title'],None) - if tagname: - # logger.debug("Forum Tag(%s) Cat(%s) list(%s)"%(stripHTML(tag),tagcat['title'],tagname)) - self.story.addToList(tagname,tstr) - else: - logger.debug("Forum Tag(%s) Cat(%s) tagname not found"%(stripHTML(tag),tagcat['title'])) + if tagname: + # logger.debug("Forum Tag(%s) list(%s)"%(stripHTML(tag),tagname)) + self.story.addToList(tagname,tstr) # else: # logger.debug("Forum Tag(%s) Uncategorized"%stripHTML(tag)) self.story.addToList('forumtags',tstr) diff --git a/fanficfare/defaults.ini b/fanficfare/defaults.ini index ee53abed..395b5e9c 100644 --- a/fanficfare/defaults.ini +++ b/fanficfare/defaults.ini @@ -1582,6 +1582,19 @@ extra_titlepage_entries:eroticatags,disclaimer #username:YourName #password:yourpassword +[althistory.com] +## Note this is NOT the same as www.alternatehistory.com +## see [base_xenforoforum] + +## Some sites require login (or login for some rated stories) The +## program can prompt you, or you can save it in config. In +## commandline version, this should go in your personal.ini, not +## defaults.ini. +## NOTE: You will probably need to have recently logged in using your +## browser to solve a captcha before this will work in FFF. +#username:YourName +#password:yourpassword + [archiveofourown.org] ## This is a OTW-archive site. ## Some sites require login (or login for some rated stories) The @@ -3394,6 +3407,7 @@ slow_down_sleep_time:2 #datechapter_format:%%Y-%%m-%%d [www.alternatehistory.com] +## Note this is NOT the same as althistory.com ## see [base_xenforoforum] ## Some sites require login (or login for some rated stories) The