mirror of
https://github.com/Fare-spec/cours.git
synced 2025-12-08 03:00:37 +00:00
14 lines
327 B
Python
14 lines
327 B
Python
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")))
|