fix download of items that dont have subtitles

This commit is contained in:
Pedro de Oliveira 2015-03-03 12:18:30 +00:00
parent a2e88c1bdd
commit 29beeba864
1 changed files with 8 additions and 3 deletions

5
rtp.py
View File

@ -76,6 +76,7 @@ while True:
for item in items:
if exists >= 5:
sys.exit("A sair apos 5 falhas, ja devo ter tudo...")
# url
link = item.find('a')
# data
@ -90,9 +91,13 @@ while True:
# parte ?
pts = item.findAll('b',{'class': 'text-dark-gray'})
try:
pt = pts[1].contents[0]
pt = pt.replace('...', '').strip()
pt = pt.replace(' ', '_')
pt = pt.replace('\n','')
except IndexError:
pt = ""
print "-- " + dt, pt