proNlp1/infoRet.py

38 lines
920 B
Python
Raw Normal View History

2017-10-18 18:40:48 +00:00
import feedparser as fp
2017-10-18 22:00:57 +00:00
# from time import gmtime, strftime
2017-10-18 18:40:48 +00:00
2017-10-18 22:00:57 +00:00
def get_data_rss():
datUniver = fp.parse('http://www.eluniversal.com.mx/seccion/1/rss.xml')
datJorn = fp.parse('http://www.jornada.unam.mx/rss/politica.xml?v=1')
2017-10-19 16:03:48 +00:00
datCnn = fp.parse('http://expansion.mx/rss/politica')
2017-10-18 22:00:57 +00:00
file = open('rss_univ.txt', 'a')
2017-10-19 16:03:48 +00:00
file.write(str(datCnn['Date']) + ';\n')
file.write(str(datCnn) + ';\n')
2017-10-18 22:00:57 +00:00
file.write(str(datUniver.headers['Date']) + ';\n')
file.write(str(datUniver) + ';\n')
file.write(str(datJorn.headers['Date']) + ';\n')
file.write(str(datJorn) + ';\n')
file.close()
2017-10-19 16:03:48 +00:00
get_data_rss()
2017-10-18 22:00:57 +00:00
# SOME COMMANDS OF FEEDPARSER
2017-10-18 18:40:48 +00:00
# print(datUniver['feed']['link'] + '\n')
# print(datJorn['feed']['title'] + '\n')
# print(datUniver.headers['Date'])
# print(len(datUniver.entries))
# print(datUniver.entries[0])
# print(datUniver)
2017-10-18 22:00:57 +00:00
#print(strftime("%Y-%m-%d %H:%M:%S", gmtime()))