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.open("http://www.inmet.gov.br/projetos/rede/pesquisa/inicio.php")
ghost.fill("form", {"mCod":"alissonluc@yahoo.com.br", "mSenha":"bv1k0wgj"})
ghost.set_field_value("input.botao", " Acessar ")
ghost.click("input.botao", expect_loading=True)
load_account()
ghost.open("http://www.inmet.gov.br/projetos/rede/pesquisa/form_mapas_c_horario.php")
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)
urls = regex.findall(r"http://www.inmet.gov.br/projetos/rede/pesquisa/gera_serie_txt.php?[^ ]*", 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
From: Teodoro Calvo <teocalvo2@gmail.com>
To: r-br@listas.c3sl.ufpr.br
Sent: Wednesday, October 2, 2013 8:43 PM
Subject: [R-br] Usar R p/ importar informações da web
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.