From 5fdcbab46a8c68038c66a538b33825b338de3061 Mon Sep 17 00:00:00 2001 From: Jim Miller Date: Tue, 5 Jul 2016 23:22:25 -0500 Subject: [PATCH] Allow old goto/post chapter URLs in base_xenforoforum. --- fanficfare/adapters/base_xenforoforum_adapter.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fanficfare/adapters/base_xenforoforum_adapter.py b/fanficfare/adapters/base_xenforoforum_adapter.py index e7684d0d..c72fe25f 100644 --- a/fanficfare/adapters/base_xenforoforum_adapter.py +++ b/fanficfare/adapters/base_xenforoforum_adapter.py @@ -229,7 +229,7 @@ class BaseXenForoForumAdapter(BaseSiteAdapter): if ( url.startswith(self.getURLPrefix()) or url.startswith('http://'+self.getSiteDomain()) or url.startswith('https://'+self.getSiteDomain()) ) and \ - ( '/posts/' in url or '/threads/' in url or 'showpost.php' in url): + ( '/posts/' in url or '/threads/' in url or 'showpost.php' in url or 'goto/post' in url): # brute force way to deal with SB's http->https change when hardcoded http urls. url = url.replace('http://'+self.getSiteDomain(),self.getURLPrefix()) @@ -237,6 +237,9 @@ class BaseXenForoForumAdapter(BaseSiteAdapter): # http://forums.spacebattles.com/showpost.php?p=4755532&postcount=9 url = re.sub(r'showpost\.php\?p=([0-9]+)(&postcount=[0-9]+)?',r'/posts/\1/',url) + # http://forums.spacebattles.com/goto/post?id=15222406#post-15222406 + url = re.sub(r'/goto/post\?id=([0-9]+)(#post-[0-9]+)?',r'/posts/\1/',url) + url = re.sub(r'(^[\'"]+|[\'"]+$)','',url) # strip leading or trailing '" from incorrect quoting. url = re.sub(r'like$','',url) # strip 'like' if incorrect 'like' link instead of proper post URL.