David 10 lat temu
rodzic
commit
44d2e25325
1 zmienionych plików z 8 dodań i 2 usunięć
  1. 8 2
      frontpage.py

+ 8 - 2
frontpage.py

@@ -16,12 +16,16 @@ class FrontPage():
         if url.startswith("http"):
             return url.strip()
 
-        if url.startswith("/"):
+        if url.startswith("/"): #'abs'
             domain=self.getDomain(baseurl)
             if domain.endswith("/") and url.startswith("/"):
                 url=url[1:]
-
             url=domain+url
+        else: #relative
+            arr=baseurl.split("/")
+            arr.pop()
+            arr.append(url)
+            url="/".join(arr)
 
         return url.strip()
 
@@ -36,3 +40,5 @@ class FrontPage():
                 print(url)
                 continue
             self.links.append({ "href": self.fixHref(l["href"],url),"title":l.get_text() })
+
+