我希望能够在视频视图中播放网络摄像头视频响应,但是 Weather Underground 对“camurl”的 json 响应如下:
我需要播放的视频的 url 嵌入在 html 代码中,其 url 如下所示:
https://www.wunderground.com/webcams/cadot1/1216/video.html?month=11&year=2016&filename=current.mp4
有没有办法从 json 响应“camurl”中获取该 url?我听说过“html 抓取”这个术语,是否可以从 json 响应 html 页面获取嵌入的视频 url?
这是网络摄像头的完整 json 响应的样子:
{
"handle": "mahouser",
"camid": "mahouserCAM1",
"camindex": "1",
"assoc_station_id": "KCACAMAR18",
"link": "http://",
"linktext": "Michael Houser",
"cameratype": "Foscam FI9900P",
"organization": "",
"neighborhood": "Camarillo Hills",
"zip": "93010-12",
"city": "CAMARILLO",
"state": "CA",
"country": "US",
"tzname": "America/Los_Angeles",
"lat": "34.24947357",
"lon": "-119.03993988",
"updated": "2016-11-10 20:57:24",
"updated_epoch": "",
"downloaded": "2016-11-08 20:38:48",
"isrecent": "1",
"CURRENTIMAGEURL": "http://icons.wunderground.com/webcamramdisk/m/a/mahouser/1/current.jpg?t=1478812080",
"WIDGETCURRENTIMAGEURL": "http://icons.wunderground.com/webcamramdisk/m/a/mahouser/1/widget.jpg?t=1478812080",
"CAMURL": "http://www.wunderground.com/webcams/mahouser/1/show.html"
}
我查看了 jsoup 并阅读了文档,但不知道如何获取所需的 url。这是 url 在 html 中的外观:
<td class="day">
<div class="row">
<div class="small-2 medium-5 columns">
<a href="/history/airport/KAJO/2016/11/15/DailyHistory.html" class="day-num">
15
</a>
</div>
<div class="small-10 medium-7 columns">
<img src="//icons.wxug.com/i/c/v4/clear.svg" alt="Clear" class="right" />
</div>
</div>
<div class="calThumb">
<a href="http://icons.wunderground.com/webcamramdisk/c/a/cadot1/902/current.jpg?1479239986" rel="lightbox[webcam]" title="">
<img src="http://icons.wunderground.com/webcamramdisk/c/a/cadot1/902/current-thumb.jpg?1479239986" width="100" height="75" alt="" title="Click to view the time-lapse video for this day." />
</a>
</div>
<p><a href="video.html?month=11&year=2016&filename=current.mp4" class="videoText">View Video</a></p>
</td>
如何从 html 代码中获取“current.mp4”网址?