8000 Explicitly check if title is None. fixes #22 · littletao08/python-readability@0843d9c · GitHub
[go: up one dir, main page]

8000 Skip to content

Commit 0843d9c

Browse files
committed
Explicitly check if title is None. fixes buriy#22
This fixes buriy#22 which caused all titles to be blank.
1 parent 8aefc61 commit 0843d9c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

readability/htmls.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def norm_title(title):
4444

4545
def get_title(doc):
4646
title = doc.find('.//title')
47-
if not title or not title.text:
47+
if title is None or len(title.text) == 0:
4848
return '[no-title]'
4949

5050
return norm_title(title.text)
@@ -57,7 +57,7 @@ def add_match(collection, text, orig):
5757

5858
def shorten_title(doc):
5959
title = doc.find('.//title')
60-
if not title or not title.text:
60+
if title is None or len(title.text) == 0:
6161
return ''
6262

6363
title = orig = norm_title(title.text)

0 commit comments

Comments
 (0)
0