Spaces:
Sleeping
Sleeping
UPDATE: New Endpoints
Browse files- functions.py +5 -6
functions.py
CHANGED
|
@@ -266,14 +266,13 @@ def getLinks(url: str, timeout = 30):
|
|
| 266 |
anchors = soup.find_all("a")
|
| 267 |
links = []
|
| 268 |
for anchor in anchors:
|
| 269 |
-
if anchor.attrs
|
| 270 |
-
if urlparse(anchor.
|
| 271 |
-
|
| 272 |
-
elif anchor.
|
| 273 |
-
|
| 274 |
else:
|
| 275 |
pass
|
| 276 |
-
links.append(newUrl)
|
| 277 |
links = list(set(links))
|
| 278 |
else:
|
| 279 |
continue
|
|
|
|
| 266 |
anchors = soup.find_all("a")
|
| 267 |
links = []
|
| 268 |
for anchor in anchors:
|
| 269 |
+
if "href" in anchor.attrs:
|
| 270 |
+
if urlparse(anchor.attrs["href"]).netloc == urlparse(url).netloc:
|
| 271 |
+
links.append(anchor.attrs["href"])
|
| 272 |
+
elif anchor.attrs["href"].startswith("/"):
|
| 273 |
+
links.append(urljoin(url + "/", anchor.attrs["href"]))
|
| 274 |
else:
|
| 275 |
pass
|
|
|
|
| 276 |
links = list(set(links))
|
| 277 |
else:
|
| 278 |
continue
|