如何在vb.net中的多个图片框中获取谷歌图像搜索的前x个结果? [英] How do I get the first x results of google images search in multiple pictureboxes in vb.net?

查看:98
本文介绍了如何在vb.net中的多个图片框中获取谷歌图像搜索的前x个结果?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从谷歌图片搜索到vb.net中的多个图片框中获得前x个结果?

解决方案

您只需要: https://msdn.microsoft.com/en-us/library /system.net.httpwebrequest%28v=vs.110%29.aspx [ ^ ]。



基本上,你首先发送HTTP请求使用搜索,接收搜索结果并解析图像URL,为每个图像执行额外的HTTP请求以下载每个图像。使用 Image.FromStream加载每个图像

https://msdn.microsoft.com/en-us/library/93z9ee4x(v = vs.110).aspx [ ^ ]。



为每个相应的图像分配 PictureBox.Image https://msdn.microsoft.com/en-us/library/system.windows.forms.picturebox.image(v = vs.110).aspx [ ^ ]。



所有这些都与 Web抓取技术有关 http://en.wikipedia.org/wiki/Web_scraping [ ^ ]。



另见我过去的回答:

< a href =http://www.codeproject.com/Answers/285975/get-specific-data-from-web-page#answer2>从网页获取特定数据 [ ^ ],

如何从其他网站获取数据 [ ^ ]。



根据您的代表找到图像的表单设计, PictureBox 可能是也可能不是最合适的。您可能希望使用重写的 Control.OnPaint 或处理 Control.Paint 事件选择在某些控件上直接渲染图像。



-SA


但即便没有这一切,你可以抓住常规搜索,模仿常规Google用户用于搜索的所有步骤。



CUrrent问题是在C#中你不能模仿sdch压缩(到目前为止Webrequest,Webclient,HttpClient都不支持),google也不能为你提供原始结果除了你使用像chrome webbrowser这样的sdch启用软件!



你需要在你的标题中提供Avail-Dictionary并解压缩数据......

How do I get the first x results from a google images search into multiple pictureboxes in vb.net?

解决方案

All you need is this: https://msdn.microsoft.com/en-us/library/system.net.httpwebrequest%28v=vs.110%29.aspx[^].

Basically, you first send HTTP request with search, receive the search results and parse it for image URLs, for each image, perform additional HTTP request to download each image. Load each image using Image.FromStream:
https://msdn.microsoft.com/en-us/library/93z9ee4x(v=vs.110).aspx[^].

Assign PictureBox.Image to each corresponding image: https://msdn.microsoft.com/en-us/library/system.windows.forms.picturebox.image(v=vs.110).aspx[^].

All this is related to the techniques of Web scraping: http://en.wikipedia.org/wiki/Web_scraping[^].

See also my past answers:
get specific data from web page[^],
How to get the data from another site[^].

Depending on your design of the form representing found images, PictureBox may or may not be the most suitable. You may want to choose direct rendering of images on some control using overridden Control.OnPaint or handling Control.Paint event.

—SA


"But even without all that, you can scrape the regular search, imitating all the step the regular Google user uses for the search."

CUrrent problem is that in C# you cannot imitate the sdch compression (not supported so far by Webrequest, Webclient, HttpClient), and google will not deliver you the raw results except you use a sdch enable software like chrome webbrowser!

You need to provide in your header "Avail-Dictionary" and the decompress the data...


这篇关于如何在vb.net中的多个图片框中获取谷歌图像搜索的前x个结果?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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