Basic skeleton of web scrapping

Thomas Mak wrote at 2020-11-11.

#python

This is the skeleton of web scrapping with `BeautifulSoup`.

from bs4 import BeautifulSoup
import requests

url = "https://news.gov.mo/home/zh-hant"

res = requests.get(url)
soup = BeautifulSoup(res.text, "lxml")

for h5 in soup.select("h5"):
    print(h5.text.strip())

Comments

no comments yet.