Spaceglider
Spaceglider

Reputation: 107

Printing data from a xml file using BeautifulSoup and Requests

I'm trying to use BeautifulSoup4 and Requests to scrape a xml page for data however i can't seem to print the results. I don't recieve an error but no data is printed.

import time
import requests
from bs4 import BeautifulSoup

url = "website.com?xml=1"
result = requests.get(url)

content = result.content
soup = BeautifulSoup(content, "html.parser")

steamID = soup.find_all("x")
print (y)

Upvotes: 1

Views: 1474

Answers (1)

OMar Mohamed
OMar Mohamed

Reputation: 333

You should use an xml parser:

soup = BeautifulSoup(content, "xml")

Upvotes: 2

Related Questions