Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Article fail to pick some content #32

Open
guojiangwei2 opened this issue Mar 20, 2018 · 1 comment
Open

Article fail to pick some content #32

guojiangwei2 opened this issue Mar 20, 2018 · 1 comment

Comments

@guojiangwei2
Copy link

html_content = """<P>&nbsp;&nbsp;&nbsp;&nbsp;最近一个月内,三圣股份共计登上龙虎榜1次,表明三圣股份股性一般。 (<A href='http://stock.jrj.com.cn/share,002742,lhb.shtml' target=_blank>更多龙虎榜查询请点击</A>)</P><P>&nbsp;&nbsp;&nbsp;&nbsp;公司主要从事    建材化工、医药。</P>"""
article = Article(html_content)
print(article.main_text)  # pick nothing
from lxml import etree
html = etree.HTML(html_content)
html.xpath('//text()')   # pick target content successfully
@guojiangwei2
Copy link
Author

guojiangwei2 commented Mar 20, 2018

html_content = """<p>hello, word hello, word hello, word hello, word hello, word hello, word</p><p>hello, beijing. hello, word hello, word hello, word hello, word hello, word</p>"""
html_content2 = """<p>hello, word.</p><p>hello, jiangwei.</p>"""

Article(html_content).main_text  # correctly parse target content
Article(html_content2).main_text  # pick nothing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant