1
0
Fork 0
mirror of https://github.com/kemayo/leech synced 2026-01-17 13:02:50 +01:00

Handle mobile links for FFN

This commit is contained in:
David Lynch 2018-03-30 15:18:57 -05:00
parent 7d2c1647e2
commit 868ef4b157

View file

@ -14,9 +14,9 @@ class FanFictionNet(Site):
@staticmethod
def matches(url):
# e.g. https://www.fanfiction.net/s/4109686/3/Taking-Sights
match = re.match(r'^(https?://www\.fanfiction\.net/s/\d+)/?.*', url)
match = re.match(r'^https?://(?:www|m)\.fanfiction\.net/s/(\d+)/?.*', url)
if match:
return match.group(1) + '/'
return 'https://www.fanfiction.net/s/' + match.group(1) + '/'
def extract(self, url):
soup = self._soup(url)
@ -87,6 +87,6 @@ class FictionPress(FanFictionNet):
@staticmethod
def matches(url):
# e.g. https://www.fictionpress.com/s/2961893/1/Mother-of-Learning
match = re.match(r'^(https?://www\.fictionpress\.com/s/\d+)/?.*', url)
match = re.match(r'^https?://(?:www|m)\.fictionpress\.com/s/(\d+)/?.*', url)
if match:
return match.group(1) + '/'
return 'https://www.fictionpress.com/s/' + match.group(1) + '/'