示例#1
0
        public virtual int GetSubscriberCount(string feedUrl)
        {
            var rawText = _client.GetRawResultOfBasicGetRequest(feedUrl);

            var feedlyFeed = JsonConvert.DeserializeObject <FeedlyFeed>(rawText);

            return(feedlyFeed == null ? 0 : feedlyFeed.Subscribers);
        }
示例#2
0
        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));
        }
示例#3
0
        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);
            }
        }
示例#4
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>());
            }
        }
示例#5
0
        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));
            }
        }