public string AnswerText(string question)
 {
     CreateConnector(question);
     if (CheckForNotFoundMessage(_connectorForAnswer))
     {
         return(NotFoundMessage);
     }
     return(_parser.ParceAnswerToText(_connectorForAnswer.GetHtmlDocument()));
 }
예제 #2
0
        /// <summary>
        /// Returns the text in which the link is anchored with the corresponding caption
        /// </summary>
        /// <param name="url">The URL.</param>
        /// <returns>System.String.</returns>
        public string Execute(string url)
        {
            if (url.Contains("http://") || url.Contains("https://"))
            {
                _connector.SetURL(url.ToString());
            }
            else
            {
                _connector.SetURL(String.Format("https://{0}", url));
                url = String.Concat("https://", url);
            }

            HtmlDocument document = _connector.GetHtmlDocument();
            var          caption  = document.DocumentNode.SelectNodes("//title")[0].InnerHtml;

            return(String.Format("<a href='{0}'>{1}</a>", url, caption));
        }
 private bool CheckForNotFoundMessage(InternetServices.Connector connector)
 {
     connector.GetHtmlDocument();
     return(connector.GetURL() == Constants.AppSettings.Instance.NotFoundURL);
 }
예제 #4
0
 /// <summary>
 /// Checks for not found message.
 /// </summary>
 /// <param name="connector">The connector.</param>
 /// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
 private bool CheckForNotFoundMessage(InternetServices.Connector connector)
 {
     connector.GetHtmlDocument();
     return(connector.GetURL() == "sasi");
 }