Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion newspaper/cleaners.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def replace_walk_left_right(self, kid, kid_text,
and self.parser.getTag(next_node) == "a" \
and self.parser.getAttribute(
next_node, 'grv-usedalready') != 'yes':
outer = " " + self.parser.outerHtml(next_node).decode('utf-8') + " "
outer = " " + self.parser.outerHtml(next_node) + " "
replacement_text.append(outer)
nodes_to_remove.append(next_node)
self.parser.setAttribute(next_node, attr='grv-usedalready',
Expand Down
2 changes: 1 addition & 1 deletion newspaper/parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def clean_article_html(cls, node):

@classmethod
def nodeToString(cls, node):
return lxml.etree.tostring(node)
return lxml.etree.tostring(node).decode()

@classmethod
def replaceTag(cls, node, tag):
Expand Down
10 changes: 5 additions & 5 deletions tests/unit_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,11 @@ def test_parse_html(self):
with open(os.path.join(TEXT_FN, 'cnn.txt'), 'r') as f:
assert self.article.text == f.read()

# TOP_IMG = ('http://i2.cdn.turner.com/cnn/dam/assets/131129200805-'
# '01-weather-1128-story-top.jpg')
# `top_img` isn't tested because it is extracted for this particular
# article with the "reddit method", it requires internet connection
# TODO: assert self.article.top_img == TOP_IMG
# NOTE: top_img extraction requires an internet connection
# unlike the rest of this test file
TOP_IMG = ('http://i2.cdn.turner.com/cnn/dam/assets/131129200805-'
'01-weather-1128-story-top.jpg')
assert self.article.top_img == TOP_IMG

assert sorted(self.article.authors) == AUTHORS
assert self.article.title == TITLE
Expand Down