【发布时间】:2016-08-14 01:51:54
【问题描述】:
我正在使用 Jsoup 来获取 weather station 的 html。当我在天气页面上并右键单击该页面并检查它时,在 DOM 中我看到了我想要的元素,即
<span data-gm-wx-temperature="::todayWxcardVm.obs.temperature" data-text-to-replace="77"><!-- ngIf: tempPrefix --> <!-- ngIf: hasValue --><span data-ng-if="hasValue" class="dir-ltr" data-ng-bind="temp | safeDisplay">77</span><!-- end ngIf: hasValue --><!-- ngIf: hasValue --><sup data-ng-if="hasValue" class="deg dir-ltr">°</sup><!-- end ngIf: hasValue --><!-- ngIf: showTempUnit -->
<!-- ngIf: !hasValue --></span>
我希望能够在 data-text-to-replace ="77" 中获取温度值,但我的问题是 Jsoup 向我返回这个:
<span data-gm-wx-temperature="::todayWxcardVm.obs.temperature" data-text-to-replace="{{ '[[ obs.temperature ]]'.indexOf('\[\[') !== -1 ? '--' : '[[ obs.temperature ]]' }}">[[ obs.temperature ]]</span>
在哪里,而不是 data-text-to-replace="77" 我得到 data-text-to-replace={{ '[[ obs.temperature ]] }}' 我假设是角度.js 变量网站的创建者用来存储温度的值。
如何获得 obs.temperature 的实际值?
【问题讨论】:
-
你当前使用什么代码来提取你想要的值?