Add get_url_search() to base_xenforoforum_adapter.

This commit is contained in:
Jim Miller 2024-08-26 13:04:07 -05:00
parent 96d36ae71a
commit ae535e2518
2 changed files with 15 additions and 1 deletions

View file

@ -143,6 +143,7 @@ class BaseSiteAdapter(Requestable):
'''
# older idents can be uri vs url and have | instead of : after
# http, plus many sites are now switching to https.
logger.debug(url)
regexp = r'identifiers:"~ur(i|l):~^https?%s$"'%(re.sub(r'^https?','',re.escape(url)))
logger.debug(regexp)
return regexp

View file

@ -182,10 +182,23 @@ class BaseXenForoForumAdapter(BaseSiteAdapter):
## storyId, because this is called before story url has been
## parsed.
# logger.debug("pre--url:%s"%url)
url = re.sub(re.escape(cls.getPathPrefix())+r'threads/.*\.(?P<id>[0-9]+)/',cls.getPathPrefix()+r'threads/\g<id>/',url)
url = re.sub(re.escape(cls.getPathPrefix())+r'threads/.*\.(?P<id>[0-9]+)/',
cls.getPathPrefix()+r'threads/\g<id>/',url)
# logger.debug("post-url:%s"%url)
return url
@classmethod
def get_url_search(cls,url):
regexp = super(BaseXenForoForumAdapter, cls).get_url_search(url)
# https://forums.spacebattles.com/threads/xander-quest-thread-twenty-four-the-end-of-the-eighth-year-has-come.596197/
# https://www.the-sietch.com/index.php?threads/welcome-to-the-jungle.315/
# https://forum.questionablequesting.com/threads/11624/
# https://forums.sufficientvelocity.com/posts/10232301/
regexp = re.sub(r"^(?P<keep>.*(\\\?|/)(threads|posts)).*(?P<delimiter>\\\.|/)(?P<id>\d+)/",
r"\g<keep>.*(\\.|/)\g<id>/",regexp)
logger.debug(regexp)
return regexp
def performLogin(self,data):
params = {}