/* Since Folha broke the custom date search, we started to use the automatic filter * private string FormatSeachDate() * { * DateTime thisDay = DateTime.Today; * string Today = thisDay.ToString("d"); * string PastDate = thisDay.AddDays(-2).ToString("d"); * string FormattedDate = PastDate + "&sd=&ed=" + Today; * * return FormattedDate.Replace("/", "%2F"); * * } */ public override void search(string vKeyword) { Console.WriteLine("Iniciando busca Folha de SP"); try { string vWord = BaseURL.Replace("KEYWORD", prepareKeyword(vKeyword)); Document = Page.Load(vWord); Console.WriteLine("Selecionando resultados"); /*When the search can't find the keyword, it offers related searchs and show us a message with related words * wich is shown on a div with a "message info" class. Since related searchs are not interesting for us, * we skip the search */ if (!hasMessage_info(Document)) { var vDivNodes = Document.DocumentNode.SelectNodes("//div[@class='c-headline__content']"); if (vDivNodes != null) { searchListResults(vDivNodes, vKeyword); } } else { Console.WriteLine("Palavra chave não encontrada, pulando resultados relacionados"); } } catch (Exception e) { Console.WriteLine("Erro -> {0}", e.Message); FLog.writeLog("Erro na palavra chave " + vKeyword + " na folha de SP"); FLog.writeLog("Descrição do erro: " + e.Message); FLog.writeLog(" "); } }
public override void search(string vKeyword) { Console.WriteLine("Iniciando busca Valor Econômico"); try { string vWord = BaseURL.Replace("KEYWORD", prepareKeyword(vKeyword)); Document = Page.Load(vWord); Console.WriteLine("Selecionando resultados"); var vLiNodes = Document.DocumentNode.SelectNodes("//li"); if (vLiNodes != null) { searchListResults(vLiNodes, vKeyword); } } catch (Exception e) { Console.WriteLine("Erro -> {0}", e.Message); FLog.writeLog("Erro na palavra chave " + vKeyword + " no Valor econômico"); FLog.writeLog("Descrição do erro: " + e.Message); } }