如何直接创建一个动态图像的URL链接,特别是对于这个例子?

时间:2022-09-03 21:26:14

How would one create a URL link (in firefox say) that would automatically just show the latest image for wind direction from this site. The issue is that you need to click on a tab in the page to see the latest image, and I'm not sure how this works.

如何创建一个URL链接(在firefox中说),它将自动显示来自此站点的风向的最新图像。问题是您需要单击页面中的选项卡才能看到最新的图像,我不确定这是如何工作的。

The HTML for the link on the "24 Hour Wind" tab on the page is as follows below:

页面上“24小时风”标签上的链接的HTML如下所示:

<a href="javascript:void(null);" title="24 hour Wind">24 hour Wind</a>

The page itself is here:

页面本身在这里:

http://www.bom.gov.au/jsp/watl/weather/obs.jsp?graph=all_obs&station=40211

My goal is to be able to:

我的目标是能够:

a) create a link directly to the latest image in firefox b) put this link in one of my own web pages where I compile all key pieces of info I want to see in one page

a)在firefox中创建一个直接链接到最新图像的链接b)将此链接放在我自己的一个网页中,我在一个页面中编译所有要查看的关键信息

1 个解决方案

#1


1  

If you "view source" on that page, you see the image is represented by

如果您在该页面上“查看源”,则会看到图像由表示

<div class="tabbertab">
<h2>24 hour Wind</h2>   

<p><img src="/tmp/current_obs/40211_wind.png" alt="24 hour Wind Speed and Direction graph" title="24 hour Wind Speed and Direction graph" /></p>

a) create a link directly to the latest image in firefox

a)直接创建一个链接到firefox中的最新图像

If you want to open that tab on the page, you will need a way to click the div with the h2 on it with the text 24 hour wind. You can accomplish that with a Bookmarklet (credit to @Jeff for pointing that out in the comments).

如果要在页面上打开该选项卡,则需要一种方法来单击带有h2的div,文本为24小时风。您可以使用Bookmarklet实现这一点(感谢@Jeff在评论中指出这一点)。

If you just want to link to the image (without the rest of the page, you could link to

如果您只想链接到图像(没有页面的其余部分,您可以链接到

http://www.bom.gov.au/tmp/current_obs/40211_wind.png

b) put this link in one of my own web pages where I compile all key pieces of info I want to see in one page

b)将此链接放在我自己的一个网页中,我在一个页面中编译我想要查看的所有关键信息

You can directly load that image from

您可以直接从中加载该图像

http://www.bom.gov.au/tmp/current_obs/40211_wind.png

I suspect that the 40211 part changes from time-to-time. Unless you know how that number is generated, the safe bet would be to parse the page, find the current relative link, and change it to an absolute link.

我怀疑40211部分时有变化。除非你知道如何生成这个数字,否则安全的赌注是解析页面,找到当前的相对链接,并将其更改为绝对链接。

As always when scraping data from a website, make sure you are following the appropriate terms of use policy.

与从网站上抓取数据时一样,请确保遵循相应的使用条款政策。

#1


1  

If you "view source" on that page, you see the image is represented by

如果您在该页面上“查看源”,则会看到图像由表示

<div class="tabbertab">
<h2>24 hour Wind</h2>   

<p><img src="/tmp/current_obs/40211_wind.png" alt="24 hour Wind Speed and Direction graph" title="24 hour Wind Speed and Direction graph" /></p>

a) create a link directly to the latest image in firefox

a)直接创建一个链接到firefox中的最新图像

If you want to open that tab on the page, you will need a way to click the div with the h2 on it with the text 24 hour wind. You can accomplish that with a Bookmarklet (credit to @Jeff for pointing that out in the comments).

如果要在页面上打开该选项卡,则需要一种方法来单击带有h2的div,文本为24小时风。您可以使用Bookmarklet实现这一点(感谢@Jeff在评论中指出这一点)。

If you just want to link to the image (without the rest of the page, you could link to

如果您只想链接到图像(没有页面的其余部分,您可以链接到

http://www.bom.gov.au/tmp/current_obs/40211_wind.png

b) put this link in one of my own web pages where I compile all key pieces of info I want to see in one page

b)将此链接放在我自己的一个网页中,我在一个页面中编译我想要查看的所有关键信息

You can directly load that image from

您可以直接从中加载该图像

http://www.bom.gov.au/tmp/current_obs/40211_wind.png

I suspect that the 40211 part changes from time-to-time. Unless you know how that number is generated, the safe bet would be to parse the page, find the current relative link, and change it to an absolute link.

我怀疑40211部分时有变化。除非你知道如何生成这个数字,否则安全的赌注是解析页面,找到当前的相对链接,并将其更改为绝对链接。

As always when scraping data from a website, make sure you are following the appropriate terms of use policy.

与从网站上抓取数据时一样,请确保遵循相应的使用条款政策。