Created
December 13, 2015 06:42
-
-
Save dedunumax/4856150e6fc8a7fe5216 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import urllib2 | |
from xml.dom import minidom | |
__author__ = 'dedunu' | |
class Reader: | |
def get_url_list(self, url_string): | |
data = urllib2.urlopen(url_string) | |
rss_string = '' | |
for line in data: | |
rss_string = rss_string + line | |
doc = minidom.parseString(rss_string) | |
article_list = doc.getElementsByTagName('item') | |
link_list = [] | |
for item in article_list: | |
link_list.append(item.getElementsByTagName('link')[0].firstChild.data) | |
return link_list | |
# Example | |
reader = Reader() | |
url_list = reader.get_url_list('http://feeds.feedburner.com/TechCrunch/') | |
for url_item in url_list: | |
print url_item |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment