V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
xinghen57
V2EX  ›  问与答

初用 Huginn,为何部分元素抓取正常,部分元素抓取为空

  •  
  •   xinghen57 · Feb 4, 2020 · 1157 views
    This topic created in 2287 days ago, the information mentioned may be changed or developed.

    刚接触 Huginn,想自制 rss 后全文输出,目前遇到同一网页,部分元素抓取正常,部分抓取结果为空。求教问题在哪里,感谢!!!

    URL: http://www.cneb.gov.cn/guoneinews/

    目的:抓取文章标题

    抓取结果为空的代码:

    {
      "expected_update_period_in_days": "2",
      "url": "http://www.cneb.gov.cn/guoneinews/",
      "type": "html",
      "mode": "on_change",
      "extract": {
        "title": {
          "css": "#ullist > li:nth-child(1) > h2 > a",
          "value": "string(.)"
        }
      }
    }
    

    运行结果:2020-02-04_17-10-33.png


    同是该页面,正常抓取的代码

    {
      "expected_update_period_in_days": "2",
      "url": "http://www.cneb.gov.cn/guoneinews/",
      "type": "html",
      "mode": "on_change",
      "extract": {
        "title": {
          "css": "#SUBD1480918870891184 > div > div.yjxwgnejy_con01 > div.right > h2 > a",
          "value": "string(.)"
        }
      }
    }
    

    运行结果:2020-02-04_17-10-10.png

    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1033 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 32ms · UTC 18:28 · PVG 02:28 · LAX 11:28 · JFK 14:28
    ♥ Do have faith in what you're doing.