Merge pull request #3 from EddieCueto/fedora25_work

Fedora25 work
This commit is contained in:
Eddie Cueto-Mendoza 2017-10-23 19:19:35 -05:00 committed by GitHub
commit a56b8578b3
2 changed files with 21 additions and 4 deletions

18
infBack.py Normal file
View File

@ -0,0 +1,18 @@
import yaml
import feedparser as fp
rawDat = open('rss_univ.txt', 'r')
strDat = rawDat.read()
rawDat = strDat.split(';\n')
index = len(rawDat) - 1
rawDat.pop(index)
strDat = yaml.load(rawDat[0])
# this section of the code show how to extract relevant data from the dictionaries
print(len(rawDat))
print(strDat['entries'][0]['title'])
print(strDat['entries'][0]['links'][0]['href'])
print(strDat['entries'][0]['summary'])

View File

@ -10,16 +10,15 @@ def get_data_rss():
file = open('rss_univ.txt', 'a') file = open('rss_univ.txt', 'a')
file.write(str(datCnn['Date']) + ';\n') # file.write(str(datCnn.headers['Date']) + ';\n')
file.write(str(datCnn) + ';\n') file.write(str(datCnn) + ';\n')
file.write(str(datUniver.headers['Date']) + ';\n') # file.write(str(datUniver.headers['Date']) + ';\n')
file.write(str(datUniver) + ';\n') file.write(str(datUniver) + ';\n')
file.write(str(datJorn.headers['Date']) + ';\n') # file.write(str(datJorn.headers['Date']) + ';\n')
file.write(str(datJorn) + ';\n') file.write(str(datJorn) + ';\n')
file.close() file.close()
get_data_rss()
# SOME COMMANDS OF FEEDPARSER # SOME COMMANDS OF FEEDPARSER