12.07.2015 Views

METODOLOGIA DE MINERAÇÃO DE DADOS PARA ANÁLISE DO ...

METODOLOGIA DE MINERAÇÃO DE DADOS PARA ANÁLISE DO ...

METODOLOGIA DE MINERAÇÃO DE DADOS PARA ANÁLISE DO ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Elimina_navegacao_robots.py 6import stringimport os.pathimport timeprint time.strftime("%a, %d %b %Y %H:%M:%S", time.localtime())print 'Elimina logs gerados por robots...'print '----------------------------------'#le arquivo de configuracao (diretorio de trabalho)arqconf = 'Configuracao.txt'entradaconf = open(arqconf)if os.path.isfile(arqconf):for line in entradaconf:diretorio = line[0:len(line)-1]breakelse:print 'Arquivo de configuracao nao encontrado...'entradaconf.close()arqin = diretorio + '\Trabalho\\robots_ag_distintos.log'entrada = open(arqin)tab_ag = []total = 0if os.path.isfile(arqin):for line in entrada:total = total + 1if total % 50000 == 0:print totaltab_ag.append(line[0:len(line)-1])else:print 'Arquivo ' + arqin + ' nao encontrado...'entrada.close()print 'Inicio sort...'tab_ag.sort()tab_ag.reverse()print 'Fim sort...'print str(total) + ' robots_ag distintos carregados em memoria'total = 0gravado = 0robot = 0arqin = diretorio + '\Log\emagrecendo.log'arqout1 = diretorio + '\Trabalho\emagrecendo_sem_robots.log'saida1 = open(arqout1, 'w')arqout2 = diretorio + '\Trabalho\ip_agent.log'saida2 = open(arqout2, 'w')6 O programa anterior gera uma lista de agentes que acessaram o arquivo robots.txt, indicando, àprincípio, que é um robot. Entretanto, há alguns deles que acessam este arquivo porque estão embutidosem ferramentas de busca (por exemplo, MSIECrawler e Girafabot). Assim, antes de se executar esteprograma, é necessário excluir manualmente estes agentes do arquivo de entrada.179

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!