Jump to content

How do I get specific values from a rss feed


Rabagahst

Recommended Posts

Hi!

First of all, I have very little experience with xml and I just learned yesterday about RSS feeds, so please simplify your answers if you are willing to help me. I did only read that rss uses the xml format, and apologise if I've posted this in the wrong place.

I am trying to recreate an actual earth environment by using a raspberry pi that reads a RSS feed from a forecast site, which again is hooked up to an Arduino.

The feed I am using is from bbc weather:

https://weather-broker-cdn.api.bbci.co.uk/en/forecast/rss/3day/2525068

How can I pull certain values (temp, humidity, sunrise, and sundown) from the feed that can be stored as variables in a python code? Are there better ways of getting these values than using rss? I am not asking for help creating the code, I just wonder what options I have to research and learn to make this work. I apreciate any ideas or suggestions. This is only for private use and does not need to be the best or most complex solution, only a working one as I have to learn python as well. I do have experience with c# in case there are solutions more suited using that.

Link to comment
Share on other sites

If you've already managed to pull the RSS feed, and you know WHERE to get this XML from on your local file system(or otherwise), what you want is to find out how Python can parse XML strings/files for you. 

Just note that the inbuilt abilities of python are vulnerable to maliciously constructed XML so I recommend checking some of these out.

For Python3:

https://docs.python.org/3/library/xml.html

https://pypi.org/project/defusedxml/

 

You seem pretty onto things, so don't hesitate to ask questions. There are loads of knowledgeable people here.

Welcome to the W3Schools Forum!

Edited by Funce
  • Thanks 1
Link to comment
Share on other sites

Thank you for your reply Funce!

I will check out xml parsing in python right away! I also had no idea I had to worry about security, so I really apreciate you told me that! Even though there won't be any valuable information on that Raspberry Pi, securing it seemes like a good idea!

Thanks again for your aid.

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...