This commit is contained in:
louiscklaw
2025-01-31 21:57:33 +08:00
parent 52904f5284
commit 6c95c5e3ea
39 changed files with 32542 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
# %pip install beautifulsoup4
from pprint import pprint
import requests
from bs4 import BeautifulSoup
def scrape_h1():
url = 'http://example.com'
res = requests.get(url)
soup = BeautifulSoup(res.text, 'html.parser')
h1 = soup.find('h1').text
return h1
ph_dates = scrape_h1()
pprint(ph_dates)