Python 2.7.16
pip3 install requests
pip3 install beautifulsoup4
test3.py
import requests
from bs4 import BeautifulSoup
r = requests.get("https://news.yahoo.co.jp/")
soup = BeautifulSoup(r.content, "html.parser")
#Extract text only
print(soup.find("ul", "newsFeed_list").text)
Recommended Posts