美文网首页
[spider]网页内容提取之xpath

[spider]网页内容提取之xpath

作者: Franckisses | 来源:发表于2019-01-11 17:10 被阅读4次

    今天就记录一下,网页提取的神器xpath。我觉得是这些所有的网页内容提取方式中简单的一种。
    我们是使用xpath来提取网页的内容信息。

    html_doc = """
    <html><head><title>The Dormouse's story</title></head>
    <body>
    <p class="title"><b>The Dormouse's story</b></p>
    <p class="story">Once upon a time there were three little sisters; and their names were
    <a href="http://example.com/elsie" class="sister" id="link1">Elsie</a>,
    <a href="http://example.com/lacie" class="sister" id="link2">Lacie</a>and
    <a href="http://example.com/tillie" class="sister" id="link3">Tillie</a>;
    and they lived at the bottom of a well.</p>
    <p class="story">...</p>
    """
    

    相关文章

      网友评论

          本文标题:[spider]网页内容提取之xpath

          本文链接:https://www.haomeiwen.com/subject/wfzalqtx.html