mirror of
https://github.com/JimmXinu/FanFicFare.git
synced 2025-12-06 08:52:55 +01:00
New site: althistory.com (NOT alternatehistory.com) for #1252
This commit is contained in:
parent
615711f904
commit
5c79ac0b5c
5 changed files with 82 additions and 7 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
40
fanficfare/adapters/adapter_althistorycom.py
Normal file
40
fanficfare/adapters/adapter_althistorycom.py
Normal file
|
|
@ -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'
|
||||
|
||||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue