This commit is contained in:
louiscklaw
2025-02-01 02:10:52 +08:00
commit faf8366e53
40 changed files with 32528 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)