如何获取谷歌搜索结果的间接链接

how to get indirect link of google search result

本文关键字:搜索结果 链接 谷歌 何获取 获取      更新时间:2023-09-26


我想得到谷歌搜索结果的间接链接。
在谷歌搜索后,如果右键点击结果链接更改为类似的内容

https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=2&cad=rja&uact=8&ved=0CCkQFjAB&url=http%3A%2F%2Fen.wikipedia.org%2Fwiki%2FHI&ei=y8mSVJb3HYqlNqvBgIgM&usg=AFQjCNEWA_V3hjoVAu_W7mu3fbN6Q4n0Lw&sig2=dDRuO4YH9VIDXgQoZJH4tQ&bvm=bv.82001339,d.eXY

如果不点击

http://en.wikipedia.org/wiki/HI

所有这一切都是因为onmousedown中的此函数

<a class="l" onmousedown="return rwt(this,'','','','4','AFQjCNGl8DlEwS7SQ8vWxBPyiZBUbUj0Yg','Nlw9cdFH31TadhaL8C4A‌​8g','0CDEQFjAD')" href="http://....">

无论如何,我想获得间接链接,我尝试先使用javascript右键单击,然后获得链接,但我做不到
这是我的示例代码:

                HtmlElement script1 = webBrowser1.Document.CreateElement("script");
                HtmlElement script2 = webBrowser1.Document.CreateElement("script");
                HtmlElement script3 = webBrowser1.Document.CreateElement("script");
                HtmlElement script4 = webBrowser1.Document.CreateElement("script");
                script1.SetAttribute("rightc1", "function rightc1(thiselements){var element = thiselements;var e = element.ownerDocument.createEvent('MouseEvents');e.initMouseEvent('contextmenu', true, true,element.ownerDocument.defaultView, 1, 0, 0, 0, 0, false,false, false, false,2, null);return !element.dispatchEvent(e);}");
                script2.SetAttribute("rightc2", "function rightc2(thiselements){$('#thiselements').trigger({type: 'mousedown',which: 3});}");
                script3.SetAttribute("rightc3", "function rightc3(thiselements){$('#thiselements').trigger({type: 'mouseup',which: 3});}");
                script4.SetAttribute("rightc4", "function rightc4(thiselements){$('#thiselements').trigger({type: 'mousedown',which: 3}).trigger({type: 'mouseup',which: 3});}");

然后附加到链接

link.AppendChild(script1);

并运行带有此代码的脚本

webBrowser1.Document.InvokeScript("rightc1", args);


我也尝试

link.InvokeMember("Click");

并且在重定向到新页面后想要获得链接!
但这一切对我都不起作用!并返回像这样的直接链接

http://en.wikipedia.org/wiki/HI

怎么了?如何获得间接链接?可能的还有其他想法吗?

亲切问候。

只需为结果<a>标记触发mousedown事件-手动或通过代码枯萎-然后再次读取标记的href-它将包含Google重定向的链接。