Fixed indentation, encoding issue and README bug. Thanks to Greg Jast… · chenying99/python-readability@11c4d95 · GitHub
Skip to content

Commit 11c4d95

Browse files
committed
Fixed indentation, encoding issue and README bug. Thanks to Greg Jastrab. Bump version to 0.2.3
1 parent 6bf4948 commit 11c4d95

5 files changed

Lines changed: 7 additions & 9 deletions

File tree

README

Lines changed: 2 additions & 2 deletions

readability/debug.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,3 @@ def describe(node, depth=2):
2323
if depth and node.getparent() is not None:
2424
return name+' - '+describe(node.getparent(), depth-1)
2525
return name
26-

readability/encoding.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,3 @@ def get_encoding(page):
1919
if enc == 'MacCyrillic':
2020
enc = 'cp1251'
2121
return enc
22-

readability/readability.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,8 @@ def summary(self):
121121
else:
122122
logging.debug("Ruthless and lenient parsing did not work. Returning raw html")
123123
article = self.html.find('body')
124-
if article is None:
125-
article = self.html
124+
if article is None:
125+
article = self.html
126126

127127
cleaned_article = self.sanitize(article, candidates)
128128
of_acceptable_length = len(cleaned_article or '') >= (self.options['retry_length'] or self.RETRY_LENGTH)
@@ -497,8 +497,8 @@ def main():
497497
import urllib
498498
file = urllib.urlopen(options.url)
499499
else:
500-
file = open(args[0])
501-
enc = sys.stdout.encoding or 'utf-8'
500+
file = open(args[0], 'rt')
501+
enc = sys.__stdout__.encoding or 'utf-8'
502502
try:
503503
print Document(file.read(), debug=options.verbose).summary().encode(enc, 'replace')
504504
finally:

setup.py

Lines changed: 1 addition & 1 deletion

0 commit comments

Comments
 (0)