Fixed possible issue with linking to interwiki

This commit is contained in:
Frisk 2018-09-08 00:10:38 +02:00
parent 61015991a3
commit f8b2d6ac71
No known key found for this signature in database
GPG key ID: 0E9A7D3C0A01586C

View file

@ -49,7 +49,9 @@ class MyHTMLParser(HTMLParser):
for attr in attrs:
if attr[0] == 'href':
self.recent_href=attr[1]
if not self.recent_href.startswith("https"):
if self.recent_href.startswith("//"):
self.recent_href = "https:{rest}".format(rest=self.recent_href)
elif not self.recent_href.startswith("https"):
self.recent_href = "https://{wiki}.gamepedia.com".format(wiki=settings["wiki"]) + self.recent_href
def handle_data(self, data):
if self.recent_href: