/
🤖

Basic skeleton of web scrapping

PythonWeb Scrapping

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())

Edit this page
Code Snippets & Notes by Makzan