I am working on WinForms (C #) to find rank and keyword positions in Google and Bing. For this, I use Newtonsoft.Json.Net2.0.dll
. While I start the process, it shows an error:
Unable to access child value in Newtonsoft.Json.Linq.JValue.
How can I solve this problem?
public class GoogleSearch { public int Search(string siteUrl, string searchExpression, ref string stage) { int position = 100; const string urlTemplate = @"http://ajax.googleapis.com/ajax/services/search/web?v=1.0&rsz=large&safe=active&q={0}&start={1}"; var resultsList = new List<SearchType>(); int[] offsets = { 0, 8, 16, 24, 32, 40, 48 }; foreach (var offset in offsets) { var searchUrl = new Uri(string.Format(urlTemplate, searchExpression, offset)); string page = new WebClient().DownloadString(searchUrl); JObject googleSearch = JObject.Parse(page); IList<JToken> results = googleSearch["responseData"]["results"].Children().ToList();
source share