Another chapter normalize pattern for base_xenforoforum_adapter.

This commit is contained in:
Jim Miller 2021-02-02 16:37:48 -06:00
parent 0795225cc7
commit fd1a1e357b

View file

@ -146,6 +146,12 @@ class BaseXenForoForumAdapter(BaseSiteAdapter):
if '#post-' in url:
url = self.getURLPrefix()+'posts/'+url.split('#post-')[1]+'/'
# https://forums.spacebattles.com/threads/beaconhills-morning-worm-one-shot-series-worm.325982/post-73457958
# https://forums.spacebattles.com/threads/325982/post-73457958
# both need to become:
# https://forums.spacebattles.com/posts/73457958/
url = re.sub(re.escape(self.getPathPrefix())+r'threads/.*/post-([0-9]+)/?$',self.getPathPrefix()+r'posts/\1/',url)
## Same as above except for for case where author mistakenly
## used the reply link instead of normal link to post.
# "http://forums.spacebattles.com/threads/manager-worm-story-thread-iv.301602/reply?quote=15962513"