Made request.py

This commit is contained in:
WahPlus
2026-09-16 20:06:29 +03:00
parent bbe5530de1
commit 1b378baaef
+11
View File
@@ -0,0 +1,11 @@
from selectolax.parser import HTMLParser
import requests
def getLinks(url):
resp = requests.get(url, timeout=10)
resp.raise_for_status()
tree = HTMLParser(resp.text)
links = [a.attributes.get('href') for a in tree.css('a[href]')]
return links
print(getLinks("https://google.com"))