Fix Tildes comments with unknown authors
This commit is contained in:
parent
19e9a80be1
commit
5fd4fdb21c
|
@ -46,7 +46,8 @@ def comment(i):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
c = {}
|
c = {}
|
||||||
c['author'] = str(i.find('a', class_='link-user').string)
|
lu = i.find('a', class_='link-user')
|
||||||
|
c['author'] = str(lu.string if lu else 'unknown user')
|
||||||
c['score'] = 1
|
c['score'] = 1
|
||||||
c['date'] = unix(i.find('time')['datetime'])
|
c['date'] = unix(i.find('time')['datetime'])
|
||||||
c['text'] = i.find('div', class_='comment-text').encode_contents().decode()
|
c['text'] = i.find('div', class_='comment-text').encode_contents().decode()
|
||||||
|
@ -109,7 +110,7 @@ if __name__ == '__main__':
|
||||||
#print(self_post)
|
#print(self_post)
|
||||||
#li_comment = story('gqx')
|
#li_comment = story('gqx')
|
||||||
#print(li_comment)
|
#print(li_comment)
|
||||||
broken = story('hmi')
|
broken = story('hsg')
|
||||||
print(broken)
|
print(broken)
|
||||||
|
|
||||||
# make sure there's no self-reference
|
# make sure there's no self-reference
|
||||||
|
|
Loading…
Reference in New Issue
Block a user