mirror of
https://github.com/Fare-spec/cours.git
synced 2025-12-11 04:10:39 +00:00
first commit
This commit is contained in:
13
referencement/search.py
Normal file
13
referencement/search.py
Normal file
@@ -0,0 +1,13 @@
|
||||
import requests
|
||||
from bs4 import BeautifulSoup
|
||||
def search(url):
|
||||
r = requests.get(url)
|
||||
return r.text
|
||||
|
||||
|
||||
def search_urls_in_text(content):
|
||||
soup = BeautifulSoup(content, 'html5lib')
|
||||
hrefs = [a['href'] for a in soup.find_all('a', href=True)]
|
||||
return hrefs
|
||||
|
||||
print(search_urls_in_text(search("https://google.com")))
|
||||
Reference in New Issue
Block a user