protected override string GetUrl() { if (this.Server == YahooServer.YQL) { return(MyHelper.YqlUrl("*", "yahoo.search.suggestions", "command=\"" + this.Query + '"', null, false)); } else { System.Text.StringBuilder url = new System.Text.StringBuilder(); url.Append("http://sugg."); url.Append(YahooHelper.ServerString(this.Server)); url.Append("search.yahoo.com/gossip-"); if (this.Server == YahooServer.USA) { url.Append("us"); } else { url.Append(YahooHelper.ServerString(this.Server).Replace(".", "")); } url.Append("-sayt/?output=xml&nresults=10"); url.Append("&command="); url.Append(Uri.EscapeDataString(this.Query)); return(url.ToString()); } }
protected override string GetUrl() { if (this.Query.Trim() == string.Empty) { throw new ArgumentNullException("Query", "The query text is empty."); } System.Text.StringBuilder url = new System.Text.StringBuilder(); url.Append("http://"); url.Append(YahooHelper.ServerString(this.Server)); url.Append("finance.yahoo.com/lookup/"); switch (this.Type) { case SecurityType.Any: url.Append("all"); break; case SecurityType.ETF: url.Append("etfs"); break; case SecurityType.Fund: url.Append("funds"); break; case SecurityType.Future: url.Append("futures"); break; case SecurityType.Index: url.Append("indices"); break; case SecurityType.Stock: url.Append("stocks"); break; case SecurityType.Warrant: url.Append("warrants"); break; case SecurityType.Currency: url.Append("currency"); break; } url.Append("?s="); url.Append(Uri.EscapeDataString(this.Query)); url.Append("&t="); if (this.Type == SecurityType.Fund) { url.Append('M'); } else { url.Append(char.ToUpper(this.Type.ToString()[0])); } url.Append("&m="); switch (this.Markets) { case FinancialMarket.France: url.Append("FR"); break; case FinancialMarket.Germany: url.Append("DR"); break; case FinancialMarket.Spain: url.Append("ES"); break; case FinancialMarket.UK: url.Append("GB"); break; case FinancialMarket.UsAndCanada: url.Append("US"); break; default: url.Append("ALL"); break; } url.Append("&r="); if (this.RankedBy != SecurityRankProperty.NoRanking) { int rankNumber = Convert.ToInt32(this.RankedBy); if (this.RankingDirection == ListSortDirection.Descending) { rankNumber += 1; } url.Append(rankNumber.ToString()); } url.Append("&b="); url.Append(this.ResultsIndex); return(url.ToString()); string whereClause = string.Format("url=\"{0}\" AND xpath='//div[@id=\"yfi_sym_lookup\"]'", url.ToString()); return(MyHelper.YqlUrl("*", "html", whereClause, null, false)); }