예제 #1
0
        /// <summary>
        /// Executes a given query by accessing a link, not by building the link.
        /// </summary>
        /// <param name="link">The link to access.</param>
        /// <returns>A CrawlerQueryResult object which can be used to retrieve various results.</returns>
        public async Task <CrawlerQueryResult> ExecuteLinkAsync(string link)
        {
            CrawlerQueryResult result = new CrawlerQueryResult();
            WebClient          client = new WebClient();

            result.RawResult = await client.DownloadStringTaskAsync(link);

            return(result);
        }
예제 #2
0
        /// <summary>
        /// Executes a given query using the Facebook Graph API.
        /// </summary>
        /// <param name="query">The query to execute. This will be appended to https://graph.facebook.com/v2.2/ </param>
        /// <returns>A CrawlerQueryResult object which can be used to retrieve various results.</returns>
        public async Task <CrawlerQueryResult> ExecuteQueryAsync(string query)
        {
            string queryPath = Crawler.QUERY_BASE_PATH + query + "/feed";

            if (queryPath.Contains('?'))
            {
                queryPath += "&access_token=" + this.AccessToken;
            }
            else
            {
                queryPath += "?access_token=" + this.AccessToken;
            }

            CrawlerQueryResult result = new CrawlerQueryResult();
            WebClient          client = new WebClient();

            result.RawResult = await client.DownloadStringTaskAsync(queryPath);

            return(result);
        }