从 NOAA 潮汐预报网站下载 XML
Downloading XML from NOAA tide prediction site
我正在尝试从我正在编写的程序中以编程方式访问 XML 格式的 NOAA 每日潮汐预测数据(即每天的高潮和低潮时间)。这些数据可从 NOAA 网站免费获得。问题是似乎没有 URL 来获取 XML 数据。相反,在我看来,需要单击一个表单按钮,然后运行一些 JavaScript 下载 XML 文件。是否可以通过 WGET 或 CURL 命令访问每日 xml 数据?
URL例如潮汐数据为:NOAA URL
我尝试以编程方式下载的文件可通过右侧的 Download: XML
按钮访问。
由于 target="_blank"
属性,名为 "dataform" 的表单在新的 window 中打开。
如果您在 Chrome 中转到该页面并打开开发人员工具,则可以删除 target="_blank"
属性。然后再次单击 "XML" 按钮,您将在网络选项卡中看到该呼叫。
这是 cURL 中的调用:
curl 'https://tidesandcurrents.noaa.gov/noaatidepredictions/NOAATidesFacade.jsp?datatype=XML&Stationid=9414275&text=datafiles%252F9414275%252F11022017%252F725%252F&imagename=images%2F9414275%2F11022017%2F725%2F9414275_2017-02-12.gif&bdate=20170211&timelength=daily&timeZone=2&dataUnits=1&interval=&edate=20170212&StationName=Ocean+Beach%2C+outer+coast&Stationid_=9414275&state=CA&primary=Subordinate&datum=MLLW&timeUnits=2&ReferenceStationName=San+Francisco&ReferenceStation=9414290&HeightOffsetLow=%2B0.00&HeightOffsetHigh=%2B0.10&TimeOffsetLow=-35&TimeOffsetHigh=-49&pageview=dayly&print_download=true&Threshold=&thresholdvalue=' -H 'Pragma: no-cache' -H 'Accept-Encoding: gzip, deflate, sdch, br' -H 'Accept-Language: en-US,en;q=0.8' -H 'Upgrade-Insecure-Requests: 1' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' -H 'Referer: https://tidesandcurrents.noaa.gov/noaatidepredictions/NOAATidesFacade.jsp?Stationid=9414275' -H 'Cookie: JSESSIONID=04E346F2DBB84B570709549D8C9B53A3; fsr.r=%7B%22d%22%3A90%2C%22i%22%3A%22de358f8-93151566-93f1-ff56-3e6a0%22%2C%22e%22%3A1487454627727%7D; SRVNAME=tc1; __utmt_GSA_CP1=1; __utmt_GSA_CP2=1; __utma=226417439.2089781402.1486849149.1486849149.1486849149.1; __utmb=226417439.31.10.1486849149; __utmc=226417439; __utmz=226417439.1486849149.1.1.utmcsr=google|utmccn=(organic)|utmcmd=organic|utmctr=(not%20provided); fsr.s=%7B%22v2%22%3A-2%2C%22v1%22%3A1%2C%22rid%22%3A%22de358f8-93151566-93f1-ff56-3e6a0%22%2C%22ru%22%3A%22https%3A%2F%2Fwww.google.com%2F%22%2C%22r%22%3A%22www.google.com%22%2C%22st%22%3A%22%22%2C%22to%22%3A5%2C%22c%22%3A%22https%3A%2F%2Ftidesandcurrents.noaa.gov%2Fnoaatidepredictions%2FNOAATidesFacade.jsp%22%2C%22pv%22%3A16%2C%22lc%22%3A%7B%22d0%22%3A%7B%22v%22%3A16%2C%22s%22%3Atrue%7D%7D%2C%22cd%22%3A0%2C%22sd%22%3A0%2C%22f%22%3A1486851107122%2C%22l%22%3A%22en%22%2C%22i%22%3A-1%7D' -H 'Connection: keep-alive' -H 'Cache-Control: no-cache' --compressed
我正在尝试从我正在编写的程序中以编程方式访问 XML 格式的 NOAA 每日潮汐预测数据(即每天的高潮和低潮时间)。这些数据可从 NOAA 网站免费获得。问题是似乎没有 URL 来获取 XML 数据。相反,在我看来,需要单击一个表单按钮,然后运行一些 JavaScript 下载 XML 文件。是否可以通过 WGET 或 CURL 命令访问每日 xml 数据?
URL例如潮汐数据为:NOAA URL
我尝试以编程方式下载的文件可通过右侧的 Download: XML
按钮访问。
由于 target="_blank"
属性,名为 "dataform" 的表单在新的 window 中打开。
如果您在 Chrome 中转到该页面并打开开发人员工具,则可以删除 target="_blank"
属性。然后再次单击 "XML" 按钮,您将在网络选项卡中看到该呼叫。
这是 cURL 中的调用:
curl 'https://tidesandcurrents.noaa.gov/noaatidepredictions/NOAATidesFacade.jsp?datatype=XML&Stationid=9414275&text=datafiles%252F9414275%252F11022017%252F725%252F&imagename=images%2F9414275%2F11022017%2F725%2F9414275_2017-02-12.gif&bdate=20170211&timelength=daily&timeZone=2&dataUnits=1&interval=&edate=20170212&StationName=Ocean+Beach%2C+outer+coast&Stationid_=9414275&state=CA&primary=Subordinate&datum=MLLW&timeUnits=2&ReferenceStationName=San+Francisco&ReferenceStation=9414290&HeightOffsetLow=%2B0.00&HeightOffsetHigh=%2B0.10&TimeOffsetLow=-35&TimeOffsetHigh=-49&pageview=dayly&print_download=true&Threshold=&thresholdvalue=' -H 'Pragma: no-cache' -H 'Accept-Encoding: gzip, deflate, sdch, br' -H 'Accept-Language: en-US,en;q=0.8' -H 'Upgrade-Insecure-Requests: 1' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' -H 'Referer: https://tidesandcurrents.noaa.gov/noaatidepredictions/NOAATidesFacade.jsp?Stationid=9414275' -H 'Cookie: JSESSIONID=04E346F2DBB84B570709549D8C9B53A3; fsr.r=%7B%22d%22%3A90%2C%22i%22%3A%22de358f8-93151566-93f1-ff56-3e6a0%22%2C%22e%22%3A1487454627727%7D; SRVNAME=tc1; __utmt_GSA_CP1=1; __utmt_GSA_CP2=1; __utma=226417439.2089781402.1486849149.1486849149.1486849149.1; __utmb=226417439.31.10.1486849149; __utmc=226417439; __utmz=226417439.1486849149.1.1.utmcsr=google|utmccn=(organic)|utmcmd=organic|utmctr=(not%20provided); fsr.s=%7B%22v2%22%3A-2%2C%22v1%22%3A1%2C%22rid%22%3A%22de358f8-93151566-93f1-ff56-3e6a0%22%2C%22ru%22%3A%22https%3A%2F%2Fwww.google.com%2F%22%2C%22r%22%3A%22www.google.com%22%2C%22st%22%3A%22%22%2C%22to%22%3A5%2C%22c%22%3A%22https%3A%2F%2Ftidesandcurrents.noaa.gov%2Fnoaatidepredictions%2FNOAATidesFacade.jsp%22%2C%22pv%22%3A16%2C%22lc%22%3A%7B%22d0%22%3A%7B%22v%22%3A16%2C%22s%22%3Atrue%7D%7D%2C%22cd%22%3A0%2C%22sd%22%3A0%2C%22f%22%3A1486851107122%2C%22l%22%3A%22en%22%2C%22i%22%3A-1%7D' -H 'Connection: keep-alive' -H 'Cache-Control: no-cache' --compressed