initial commit
This commit is contained in:
14
example1.py
Normal file
14
example1.py
Normal file
@@ -0,0 +1,14 @@
|
||||
import requests
|
||||
import xml.etree.ElementTree as ET
|
||||
|
||||
rss_url = "https://news.google.com/rss/search?q=mathematics"
|
||||
|
||||
response = requests.get(rss_url)
|
||||
root = ET.fromstring(response.content)
|
||||
|
||||
for item in root.findall(".//item")[:5]:
|
||||
title = item.find("title").text
|
||||
link = item.find("link").text
|
||||
print("Title:", title)
|
||||
print("Link:", link)
|
||||
print("-" * 40)
|
||||
Reference in New Issue
Block a user