File tree Expand file tree Collapse file tree 5 files changed +7
-9
lines changed Expand file tree Collapse file tree 5 files changed +7
-9
lines changed Original file line number Diff line number Diff line change @@ -18,9 +18,9 @@ Based on:
18
18
19
19
Installation::
20
20
21
- easy_install readability-xml
21
+ easy_install readability-lxml
22
22
or
23
- pip install readability-xml
23
+ pip install readability-lxml
24
24
25
25
Usage::
26
26
Original file line number Diff line number Diff line change @@ -23,4 +23,3 @@ def describe(node, depth=2):
23
23
if depth and node .getparent () is not None :
24
24
return name + ' - ' + describe (node .getparent (), depth - 1 )
25
25
return name
26
-
Original file line number Diff line number Diff line change @@ -19,4 +19,3 @@ def get_encoding(page):
19
19
if enc == 'MacCyrillic' :
20
20
enc = 'cp1251'
21
21
return enc
22
-
Original file line number Diff line number Diff line change @@ -121,8 +121,8 @@ def summary(self):
121
121
else :
122
122
logging .debug ("Ruthless and lenient parsing did not work. Returning raw html" )
123
123
article = self .html .find ('body' )
124
- if article is None :
125
- article = self .html
124
+ if article is None :
125
+ article = self .html
126
126
127
127
cleaned_article = self .sanitize (article , candidates )
128
128
of_acceptable_length = len (cleaned_article or '' ) >= (self .options ['retry_length' ] or self .RETRY_LENGTH )
@@ -497,8 +497,8 @@ def main():
497
497
import urllib
498
498
file = urllib .urlopen (options .url )
499
499
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'
502
502
try :
503
503
print Document (file .read (), debug = options .verbose ).summary ().encode (enc , 'replace' )
504
504
finally :
Original file line number Diff line number Diff line change 3
3
4
4
setup (
5
5
name = "readability-lxml" ,
6
- version = "0.2.2 " ,
6
+ version = "0.2.3 " ,
7
7
author = "Yuri Baburov" ,
8
8
author_email = "burchik@gmail.com" ,
9
9
description = "fast python port of arc90's readability tool" ,
You can’t perform that action at this time.
0 commit comments