自动从网页下载验证码 [英] automatically download captcha from webpage

查看:85
本文介绍了自动从网页下载验证码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨!

我想创建一个C#应用程序,它可以自动从网站下载验证码图像。有人可以告诉我怎么可能.?

Hi!
i want to create a C# app which automatically download captcha images from a website. can somebody tells me how is it possible.?

推荐答案

如果您知道某个网站的验证码元素的ID,您可以获取它的src属性并从url。

这是一个div标记中的验证码img的示例,其id为recaptcha_image。

If you know the id of the captcha element for a certain website you can get it's src attribute and download from the url.
Here is an example of a captcha img in a div tag with the id "recaptcha_image".
<div id="recaptcha_image" style="width: 300px; height: 57px; "><img style="display:block;" alt="reCAPTCHA challenge image" height="57" width="300" src="http://www.google.com/recaptcha/api/image?c=03AHJ_Vus407GuhxqGfVSZawlQp2afR8Ov0GI0zpZolxeHbjXa5dRThbO0XWzAduWq5P7JNzA99oGPLSjuWQtnKotfv4Jy0EwkXBZv9kj9531F6YEwSop56pRTh4hOsWnO7n-CxLtH_w4pKC6OpRdw3KZZOXjgts3-Dg"></img></div>



以下是如何使用Windows窗体浏览器获取图像的示例:


Here is an example of how to get the image with a windows forms browser:

HtmlElement ele = browser.Document.GetElementById("recaptcha_image");
if (ele != null)
{
    string imageSource = ele.GetAttribute("src");
}


不,没有自动的方法 - Captcha图像就像任何其他图像一样。没有任何东西可以将其标记为Captcha图像,而不是公司徽标图像。
No, there is no automatic way to do that - a Captcha image is just an image like any other. There is nothing which marks this as a "Captcha" image, rather than a "Company logo" image instead.


我想从网站上将所有chaptcha图像下载到我的应用程序中,为什么?!因为我写了一个chaptcha求解器,如果它无法自动获取所有图像源有什么好处?!

任何想法都会受到欢迎。
I want to download all of chaptcha images into my app, from a website, why?! Because I write a chaptcha solver and what is the benefit if it couldn't get all the image sources automatically?!
Any idea will be welcome.


这篇关于自动从网页下载验证码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆