Create a python program does the following:
Find an RSS XML news feed of your choosing. The news feed must have 5 or more stories.
A good place to start is with CNN RSS. Although you may use any news feed (like NBC, ABC, CBS, etc.)
1.Create a python program named topstories.py.
2.Comments at the top of the module with your name, date, and description. 1 point.
3.Use urllib.request.urlopen to open the XML feed. 2 point.
4.Read in the lines from the response one line at a time. The lines will be a byte stream. Turn the into strings by using line.decode('utf-8') . 2 points.
5.Check the lines for the data start marker and end markers that you are looking for. This may vary depending on the news feed that you chose. Put the marker start/stop values into variables. 2 points.
6.Extract the news story headline based on the marker/stop data that you saved intovariables. Print the headline to the screen. 2 points.
7.Close the file stream you opened with urllib.request.urlopen. 1 point.
1.Once you have Part I working, complete Part II. This code is also in topstories.py. You will need to determine where to add the additional code to the existing code from Part I.
2.Open a new file named 'stories.html'. 1 point.
3.Write into the file correct structure of an html file, such as the doctype, opening html, head, title, body tags. 2 points.
4.Write the headlines to the html file. Be sure to put a <br /> at the end of each line. 2 points.
5.Close the html file with closing body and html tag. 1 point.
6.Close the file stream 'stories.html'. 1 point.
7.The code within 'stories.html' must validate correctly. Use the validator at W3C Validator to check. 2 points.
8.Open a web browser and display 'stories.html' 1 point.
This assignment has been answered 6 times in private sessions.
© 2022 Codify Tutor. All rights reserved