我怎样才能在这个网站上自动提取数据? (看不到查询选项,如果有的话)

How can I automate data extraction in this website? (can't see query options, if any)

我想从 this website 中提取选举结果(目前所有数据都为零,因为投票正在进行)。在菜单中,您可以 select 您想要的数据(我需要“En Chile” -> “División Geográfica” -> “Comunas”)。这是每个自治市(“comuna”)的投票结果。当您 select 所需的“comuna”时,您可以单击 excel 文件并下载结果。

“问题”是在整个过程中没有显示 url。我看不到我需要的特定“comuna”的 url link。我希望得到一个特定的 link,这样我就可以自动使用 wget 和每个城市的名称。相反,数据似乎被掩盖了。我知道您可以提取 JSON 数据,或许可以使用网站 HTML 代码中显示的属性:

<select class="form-control" id="selComunas" ng-model="comuSelected"
    ng-options="item.d for item in comunas" name="comunas"
    ng-show="(vistaVertical==='G' || vistaVertical==='E') && subMenu === null"
    ng-change="updateComuna()">
    <option value="">Comunas...</option>
</select>

但是在哪里打电话呢?不知道。此外,我在 HTML 中看到 excel 文件没有 link。据我在线阅读,内容似乎被隐藏在“ng”元素内,这似乎是 AngularJS。不知道如何进行。如您所见,我对此一窍不通。任何帮助都非常受欢迎。

打开 chrome 开发工具并在点击 UI

的同时寻找有用的东西

http://www.servelelecciones.cl/data/elecciones_constitucion/filters/comunas/all.json

这 link returns 所有 communas 及其 id

[{"c":2564,"d":"ALGARROBO"},{"c":2801,"d":"ALHUE"},{"c":2674,"d":"ALTO BIOBIO"},...

接下来,当我们从下拉列表中 select 值时,我们在网络选项卡中得到另一个 link。最后的数字对不对?

http://www.servelelecciones.cl/data/elecciones_constitucion/computo/comunas/2570.json

      "d":"Integer",
      "e":"Integer",
      "f":"Integer",
      "sd":null
   },
   "data":[
      {
         "a":"Apruebo",
         "b":null,
         "c":"0",
         "d":"0,00%",
         "e":null,
         "f":"",
         "sd":null
      },
      {
         "a":"Rechazo",
         "b":null,
         "c":"0",
         "d":"0,00%",
         "e":null,
         "f":"",
         "sd":null
      }

从这一点开始,您可以使用任何编程语言直接处理 JSON