You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何用C#实现谷歌搜索直接展示图片标签下的搜索结果

实现C#调用默认浏览器打开谷歌图片搜索

要直接在谷歌图片标签页展示搜索结果,只需在搜索URL中添加tbm=isch查询参数——这个参数是谷歌用来指定搜索类型为图片的标识。

修改后的URL示例

原搜索URL:

https://www.google.com/search?q=Med-L+Mamm:+Red+Necked+Wallaby

添加参数后的图片搜索URL:

https://www.google.com/search?q=Med-L+Mamm:+Red+Necked+Wallaby&tbm=isch

对应的C#代码实现

直接使用构造好的图片搜索URL调用默认浏览器:

string imageSearchUrl = "https://www.google.com/search?q=Med-L+Mamm:+Red+Necked+Wallaby&tbm=isch";
Process.Start(new ProcessStartInfo { FileName = imageSearchUrl, UseShellExecute = true });

如果需要动态处理搜索字符串,建议先对原始查询字符串进行URL编码,避免特殊字符导致的问题:

// 原始搜索字符串
string rawQuery = "Med-L Mamm: Red Necked Wallaby";
// 进行URL编码
string encodedQuery = Uri.EscapeDataString(rawQuery);
// 构造图片搜索URL
string imageSearchUrl = $"https://www.google.com/search?q={encodedQuery}&tbm=isch";
// 调用默认浏览器打开
Process.Start(new ProcessStartInfo { FileName = imageSearchUrl, UseShellExecute = true });

内容的提问来源于stack exchange,提问作者SimonKravis

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.17 18:12:04