Caro Teodoro,
Boa noite.
Exite outras maneiras, mas
você precisa saber python, assim segue outro exemplos.
from ghost import
Ghost
from bs4 import
BeautifulSoup as bs
import re
import time
import regex
from bs4 import
BeautifulSoup
import time
ghost = Ghost()
def load_account():
ghost.set_field_value("input.botao", " Acessar ")
ghost.click("input.botao", expect_loading=True)
load_account()
ghost.fill("form",
{"mRelDtInicio":"01/07/2012",
"mRelDtFim":"01/08/2012",
"mRelEstado":"MG",
"mRelRegiao":"4",
"mOpcaoAtrib1":"0",
"mOpcaoAtrib2":"0",
"mOpcaoAtrib5":"0",
"mOpcaoAtrib6":"0",
"mOpcaoAtrib8":"0",
"mOpcaoAtrib9":"0",
"mOpcaoAtrib12":"0"})
ghost.evaluate("document.frmCad.submit()",
expect_loading=True)
ghost.capture_to("/Users/Alisson/Desktop/lixo.png")
soup =
BeautifulSoup(ghost.content)
tables = {}
errors = []
for url in urls:
print url
try:
ghost.open(url)
soup =
BeautifulSoup(ghost.content)
except:
errors.append([url])
next
try:
cidade =
regex.findall(r"Esta.*?o\s*?:\s([A-Z|\s]*-\s[A-Z]*)",
soup.pre.get_text())[0]
table =
regex.findall(r"(Estacao;Data;Hora((.|\n)*))",
soup.pre.get_text())[0][0]
tables[cidade] = table
time.sleep(2)
except
IndexError:
errors.append([soup.pre])
next
for cidade, tabela
in tables.iteritems():
f =
open("/Users/Alisson/Desktop/" + cidade + ".txt", "w")
f.write(table)
f.close()
Abracos
Alisson Lucrécio da Costa
Olá, boa noite.
Como posso extrair uma parte de um texto de determinado
site, utilizando
o R ?
É possível ? Existe algum material ?
Obrigado desde já.
Att Téo Calvo.