public virtual int GetSubscriberCount(string feedUrl) { var rawText = _client.GetRawResultOfBasicGetRequest(feedUrl); var feedlyFeed = JsonConvert.DeserializeObject <FeedlyFeed>(rawText); return(feedlyFeed == null ? 0 : feedlyFeed.Subscribers); }
public static void AnalyzeAPage() { WriteLine("Url, please."); var url = System.Console.ReadLine(); var client = new SimpleWebClient(); var pageChecker = new PageChecker(); var rawHtml = client.GetRawResultOfBasicGetRequest(url); pageChecker.GetLinksFrom(rawHtml).ToList().ForEach(l => WriteLine(l)); }
public virtual int GetGlobalRank(string baseSiteUrl) { var rawXml = _client.GetRawResultOfBasicGetRequest($"http://data.alexa.com/data?cli=10&dat=snbamz&url={baseSiteUrl}"); try { return(GetRankFromXml(rawXml)); } catch { return(0); } }
private IEnumerable <SearchResult> ExecuteSearch(string searchParameters) { var rawText = _client.GetRawResultOfBasicGetRequest(BaseSearchQuery + searchParameters); try { var resultJson = JObject.Parse(rawText); var serpResults = resultJson["items"].Children(); return(serpResults.Select(sr => JsonConvert.DeserializeObject <SearchResult>(sr.ToString()))); } catch { return(Enumerable.Empty <SearchResult>()); } }
public virtual MozRecord GetMozStats(string host) { Thread.Sleep(Timeout * 1000); try { var authenticatedUrl = BuildUrl(host); var rawText = _simpleWebClient.GetRawResultOfBasicGetRequest(authenticatedUrl); dynamic mozRowJson = JsonConvert.DeserializeObject(rawText); return(new MozRecord(Math.Round((decimal)mozRowJson.pda, 2), (int)mozRowJson.pid)); } catch { return(new MozRecord(0, 0)); } }