#100DaysOfCode in Python Transcripts
Chapter: Days 52-54: Parsing RSS feeds with Feedparser
Lecture: Setting up our Feedparser environment

Login or purchase this course to watch this video and the rest of the course contents.
0:00 Okay, let's get cracking. First thing we need to do is import requests, sorry. import requests. Now I know you probably know how to use requests
0:13 so I'm not going over this too much. But what I'd like you to do is enter the URL of your feed. Now to get that for example,
0:21 we're going to be pulling the new releases XML feed from Steam. Stored up, steam powered. Okay, all I've done to get that is just Google "Steam Feed."
0:34 Came up here, I just grab the first one and there was a link on the website for their RSS feed. Okay, this is the news one, but we're actually
0:43 going to use the new releases for the video games. So you can feel free to grab whatever you want and once you do that, just pop the URL into here
0:53 and assign it to URL. So there's mine there. Next, we're just going to use our standard Python and dunder there. Okay,
1:07 and then what we're going to do is we're going to requests.get. So, essentially, we're going to get that URL and we're going to store it
1:17 or we're going to assign it to the r variable. Okay, and then we're actually going to write the contents of this file,
1:25 of this XML feed, this that you're pulling down, we're going to write that down to an XML file. Okay, so to do that,
1:33 just going to do it the old fashioned way. We're going to open a file, let's just call it newreleases. Just like the actual XML.
1:43 We're just going to write binary and we're going to open it as f. And I'm using that with Statement as usual just to make sure it closes
1:51 out right when it's done. So, we're going to write r.content. I'm not explaining this in detail because you would have experienced requests
2:03 by now, so that should be nice and familiar. But this is necessary to pull down the file. Alright, so we save that, that's all we need.
2:12 Now, head over here to your shell. Woops, we don't actually want to launch the shell, We want to go Python pull_xml.py. Alright, that completed.
2:26 Now, if we bring up our folder here, or everything that's inside, you will have seen it's created in newreleases XML file. Alright, that's it there.
2:39 Now, we'll open that file in explorer. Where are we? Open, let's just choose, okay, don't hate me. Let's just choose internet explorer.
2:52 So, now that this is open, you can have a good look at what's inside this XML file.
2:58 Pay attention, maybe while you're doing this for yours, just open this, your XML feed in a browser or in your favorite editor,
3:07 just so you can have a look at these little tags here. So pay attention to that, we'll talk about them in the next video.

Talk Python's Mastodon Michael Kennedy's Mastodon