谷歌搜索结果HTML代码c#

1 c# search google-search

我必须创建一个应用程序,对于给定的术语 - 从谷歌搜索页面下载前10个结果的链接,但是有问题,

如果我用webClient下载源代码,而不是html--我得到了JS代码.

如果我看看谷歌浏览器中的源代码(ctrl + u),我会得到相同的结果但是如果我尝试使用内置的开发人员工具检查该元素我可以看到真正的HTML代码

任何人都知道如何下载真正的HTML代码,以便我可以提取链接?

Swi*_*ift 5

您应该使用Google Custom Search API

http://code.google.com/apis/customsearch/v1/overview.html

这是一个示例,显示搜索"汽车"的前10个结果

<html>
  <head>
    <title>JSON/Atom Custom Search API Example</title>
  </head>
  <body>
    <div id="content"></div>
    <script>
      function hndlr(response) {
      for (var i = 0; i < response.items.length; i++) {
        var item = response.items[i];
        // in production code, item.htmlTitle should have the HTML entities escaped.
        document.getElementById("content").innerHTML += "<br>" + item.htmlTitle;
      }
    }
    </script>
    <script src="https://www.googleapis.com/customsearch/v1?key=YOUR-KEY&cx=017576662512468239146:omuauf_lfve&q=cars&callback=hndlr">
    </script>
  </body>
</html>
Run Code Online (Sandbox Code Playgroud)