Parseando RSS usando Python

Mais um post daqueles tutoriais ultra-fast. Neste mostrarei como fazer um parser de rss usando o Python. Veja a simplicidade do código
import urllib import sys import xml.dom.minidom # The URL of the RSS feed address = 'http://rss.slashdot.org/Slashdot/slashdot' # Our actual XML document document = xml.dom.minidom.parse(urllib.urlopen(address)) for item in document.getElementsByTagName('item'): title = item.getElementsByTagName('title')[0].firstChild.data link = item.getElementsByTagName('link')[0].firstChild.data creator = item.getElementsByTagName('dc:creator')[0].firstChild.data print '''<a href="%s">%s</a> (%s)''' % (link.encode('UTF8', 'replace'), title.encode('UTF8','replace'), creator.encode('UTF8', 'replace'))

Entre em contato

Sua opinião é muito importante para nós.

Endereço

Rua Helena, 280
8º andar

Whatsapp

99975-1271

Instagram

@bhei

CRECI: 16963J

Precisando de ajuda ?