Google API 客户端返回 404 未找到
Google API Client returning 404 not fund
我正在尝试使用关键字和 GoogleAPI 从 google 获得最佳搜索,但它总是返回“System.Net.WebException: 'The remote server returned an error: (404) Not Found.'
”
我是不是做错了什么,还是 GoogleAPI 已经过时了?上次查看和下载.dll文件是2010年的...
代码:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using System.IO;
using System.Security.Cryptography;
using System.Text.RegularExpressions;
using System.Threading;
using System.Diagnostics;
using System.Collections;
using Microsoft.Win32;
using System.Web;
using System.Net.Mail;
using System.Net.Mime;
using System.ComponentModel;
using System.Net;
using System.Windows;
using Google.Apis.Services;
using Google.Apis.CustomSearchAPI.v1;
//Ignore most using statements, It was imported from my previous code.
namespace TYZDsag
{
internal class Program
{
static void Main(string[] args)
{
var client = new Google.API.Search.GwebSearchClient("https://www.google.com/");
var results = client.Search("uhuhuh", 12);
foreach (var webResult in results)
{
Console.WriteLine("{0}, {1}, {2}", webResult.Title, webResult.Url, webResult.Content);
//listBox1.Items.Add(webResult.ToString());
}
}
}
}
这不是使用 api 键初始化服务对象的方式。
using System;
using System.Threading.Tasks;
using Google.Apis.CustomSearchAPI.v1;
using Google.Apis.Services;
namespace customsearch
{
class Program
{
static async Task Main(string[] args)
{
Console.WriteLine("Hello World!");
var service = new CustomSearchAPIService(new BaseClientService.Initializer()
{
ApiKey = "XXX",
ApplicationName = "xyz",
});
var result = await service.Cse.List().ExecuteAsync();
}
}
}
我正在尝试使用关键字和 GoogleAPI 从 google 获得最佳搜索,但它总是返回“System.Net.WebException: 'The remote server returned an error: (404) Not Found.'
”
我是不是做错了什么,还是 GoogleAPI 已经过时了?上次查看和下载.dll文件是2010年的...
代码:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using System.IO;
using System.Security.Cryptography;
using System.Text.RegularExpressions;
using System.Threading;
using System.Diagnostics;
using System.Collections;
using Microsoft.Win32;
using System.Web;
using System.Net.Mail;
using System.Net.Mime;
using System.ComponentModel;
using System.Net;
using System.Windows;
using Google.Apis.Services;
using Google.Apis.CustomSearchAPI.v1;
//Ignore most using statements, It was imported from my previous code.
namespace TYZDsag
{
internal class Program
{
static void Main(string[] args)
{
var client = new Google.API.Search.GwebSearchClient("https://www.google.com/");
var results = client.Search("uhuhuh", 12);
foreach (var webResult in results)
{
Console.WriteLine("{0}, {1}, {2}", webResult.Title, webResult.Url, webResult.Content);
//listBox1.Items.Add(webResult.ToString());
}
}
}
}
这不是使用 api 键初始化服务对象的方式。
using System;
using System.Threading.Tasks;
using Google.Apis.CustomSearchAPI.v1;
using Google.Apis.Services;
namespace customsearch
{
class Program
{
static async Task Main(string[] args)
{
Console.WriteLine("Hello World!");
var service = new CustomSearchAPIService(new BaseClientService.Initializer()
{
ApiKey = "XXX",
ApplicationName = "xyz",
});
var result = await service.Cse.List().ExecuteAsync();
}
}
}