获取验证码会话的图像 [英] Get image for captcha session
问题描述
我想获取网站上显示的当前验证码。这方面的一个例子是
。
以下是此类提取网址的示例:
<小时>
实际上,似乎chapta框是一个iframe。因此,搜索包含chapta的src字符串的iframe。这样的iframe示例:
< iframe src =http://www.google.com/recaptcha/api/ noscriptk = 6LeyFroSAAAAAJTmR7CLZ5an7pcsS5eJ3wEoWHhJ
height =300width =500frameborder =0>< / iframe>< br />
因此,提取该URL后,再次使用JSoup查找图像的URL。获取的页面包含以下内容:
所以,寻找一个中心元素,并从中获取img元素。
I want to get the current captcha that is displayed on a website. An example of this would be http://top100arena.com/in.asp?id=58978
How would I get the image link of the captcha that is displayed other than right clicking - > open image in new page?
You are looking for the div identified by "rechapta_image"
:
Then extract the src
attribute of the img element inside this div.
To do this, you can choose for an easy String-operation-based way or use a HTML parsing library like JSoup.
Here is an example of such an extract URL:
Actually, it seems that the chapta box is an iframe. So search for an iframe with src string containing "chapta". Example of such a iframe:
<iframe src="http://www.google.com/recaptcha/api/noscriptk=6LeyFroSAAAAAJTmR7CLZ5an7pcsS5eJ3wEoWHhJ"
height="300" width="500" frameborder="0"></iframe><br/>
So, once you extracted that URL, use JSoup again to find the URL to the image. The page fetched has a part this:
So, look for a center element, and get the img element out of it.
这篇关于获取验证码会话的图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!