This commit is contained in:
Eddie 2017-10-18 17:00:57 -05:00
parent 3cb8d110bd
commit 80cd002bf1
1 changed files with 18 additions and 9 deletions

View File

@ -1,8 +1,23 @@
import feedparser as fp import feedparser as fp
# from time import gmtime, strftime
def get_data_rss():
datUniver = fp.parse('http://www.eluniversal.com.mx/seccion/1/rss.xml') 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') datJorn = fp.parse('http://www.jornada.unam.mx/rss/politica.xml?v=1')
file = open('rss_univ.txt', 'a')
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()
# SOME COMMANDS OF FEEDPARSER
# print(datUniver['feed']['link'] + '\n') # print(datUniver['feed']['link'] + '\n')
# print(datJorn['feed']['title'] + '\n') # print(datJorn['feed']['title'] + '\n')
@ -13,11 +28,5 @@ datJorn = fp.parse('http://www.jornada.unam.mx/rss/politica.xml?v=1')
# print(datUniver) # print(datUniver)
file = open('rss_univ.txt', 'a')
file.write(str(datUniver.headers['Date']) + ';\n') #print(strftime("%Y-%m-%d %H:%M:%S", gmtime()))
file.write(str(datUniver) + ';\n')
file.write(str(datJorn.headers['Date']) + ';\n')
file.write(str(datJorn) + ';\n')
file.close()