def Amazonas(self): holidays2020 = np.array(['2020-01-01','2020-02-24','2020-02-25','2020-02-26','2020-04-08','2020-04-09','2020-04-10','2020-04-21','2020-05-01','2020-06-11','2020-06-24','2020-06-29','','2020-09-07','2020-09-16','2020-10-12','2020-10-28','2020-11-02','2020-11-15','2020-11-20','2020-11-30','2020-12-08','2020-12-24','2020-12-25','2020-12-30'],dtype='datetime64') self.__log("Data de inicio e fim da pesquisa:","green") dataInit,dataFim = self.__askDate() start = np.datetime64(dataInit) end = np.datetime64(dataFim) e='AM' date =start while date <= end: dia = str(date).rsplit('-')[2] mes = str(date).rsplit('-')[1] ano = str(date).rsplit('-')[0] dateStr = dia+"/"+mes+"/"+ano if np.is_busday(date,holidays=holidays2020): nomeArquivo = "Diario-"+str(date)+".pdf" fileUrl = "https://consultasaj.tjam.jus.br/cdje/downloadCaderno.do?dtDiario="+dateStr+"&cdCaderno=2&tpDownload=D" downloadFile(fileUrl,nomeArquivo,e) print("Download:"+nomeArquivo) date = date + np.timedelta64(1,'D') print("Arquivos Baixados")
def Sergipe(self): holidays2020 = np.array(['2020-01-01','2020-01-02','2020-01-03','2020-01-04','2020-01-05','2020-01-06','2020-02-24','2020-02-25','2020-02-26','2020-03-16','2020-03-17','2020-04-09','2020-04-10','2020-04-21','2020-05-01','2020-05-01','2020-05-22','2020-05-25','2020-05-26','2020-06-11','2020-09-07','2020-10-12','2020-11-02','2020-11-15','2020-12-24','2020-12-25','2020-12-30'],dtype='datetime64') self.__log("Data de inicio e fim da pesquisa:","green") dataInit,dataFim = self.__askDate() start = np.datetime64(dataInit) end = np.datetime64(dataFim) date = start e='SE' while date <= end: if np.is_busday(date,holidays=holidays2020): edicao = self.__EdicaoSE(date) nomeArquivo = "Diario-"+str(date)+".pdf" fileUrl ="http://www.diario.tjse.jus.br/diario/diarios/"+edicao+".pdf" diretorio = e downloadFile(fileUrl,nomeArquivo,diretorio) print("Download:"+nomeArquivo) date = date + np.timedelta64(1,'D') print("Arquivos Baixados")
def Tocantins(self): result = requests.get("https://wwa.tjto.jus.br/diario/pesquisa/arquivos") c = result.content soup = BeautifulSoup(c, 'html.parser') elementsA = soup.find_all('a') lista = [] for link in elementsA: lista.append(link.get('href')) listHref = [] for i in lista: temp = i.rsplit(".") if temp[-1] == "pdf": listHref.append(i) e='TO' for fileUrl in listHref: temp = fileUrl.rsplit(".") tempEdicao = temp[-2].rsplit("/") edicao = tempEdicao[-1] nomeArquivo = "Diario-"+edicao+".pdf" diretorio = e+"/2020" self.__log("Download:"+nomeArquivo,"red") downloadFile(fileUrl,nomeArquivo,diretorio) self.__log("Concluido","green")
def Roraima(self): holidays2020 = np.array(['2020-01-01','2020-01-20','2020-02-24','2020-02-25','2020-02-26','2020-04-09','2020-04-10','2020-04-20','2020-04-21','2020-05-01','2020-06-11','2020-06-12','2020-06-29','2020-07-09','2020-07-10','2020-08-10','2020-09-07','2020-09-16','2020-10-12','2020-10-28','2020-11-02','2020-11-15','2020-11-20','2020-11-30','2020-12-08','2020-12-24','2020-12-25','2020-12-31'],dtype='datetime64') self.__log("Data de inicio e fim da pesquisa:","green") dataInit,dataFim = self.__askDate() start = np.datetime64(dataInit) end = np.datetime64(dataFim) date = start e='RR' while date <= end: dia = str(date).rsplit('-')[2] mes = str(date).rsplit('-')[1] ano = str(date).rsplit('-')[0] if np.is_busday(date,holidays=holidays2020): nomeArquivo = "Diario-"+str(date)+".pdf" fileUrl = "http://diario.tjrr.jus.br/dpj/dpj-"+ano+mes+dia+".pdf" downloadFile(fileUrl,nomeArquivo,e) print("Download:"+nomeArquivo) date = date + np.timedelta64(1,'D') print("Arquivos Baixados")
def Rondonia(self): self.__log("Data de inicio e fim da pesquisa:","green") dataInit,dataFim = self.__askDate() start = np.datetime64(dataInit) end = np.datetime64(dataFim) ano = str(start).rsplit('-')[0] url = "https://portal.tjro.jus.br/diario-api/list.php?ano="+ano result = requests.get(url) diarios = result.json() e='RO' date =start while date <= end: dia = str(date).rsplit('-')[2] mes = str(date).rsplit('-')[1] nomeArquivo = "Diario-"+str(date)+".pdf" fileUrl = self.__apiUrl(diarios,dia,mes,ano) if fileUrl != "Not Found": downloadFile(fileUrl,nomeArquivo,e) print("Download:"+nomeArquivo) date = date + np.timedelta64(1,'D') print("Arquivos Baixados")
def MatoGrosso(self): holidays2020 = np.array(['2020-01-01','2020-02-24','2020-02-25','2020-02-26','2020-04-09','2020-04-10','2020-04-20','2020-04-21','2020-05-01','2020-06-11','2020-06-12','2020-09-07','2020-10-12','2020-11-02','2020-11-15','2020-11-20','2020-12-08','2020-12-24','2020-12-25','2020-12-30'],dtype='datetime64') self.__log("Data de inicio e fim da pesquisa:","green") dataInit,dataFim = self.__askDate() start = np.datetime64(dataInit) end = np.datetime64(dataFim) date = start e='MT' while date <= end: if np.is_busday(date,holidays=holidays2020): edicao = self.__definirEdicaoMT(date) nomeArquivo = "Diario-"+str(edicao)+".pdf" fileUrl = "http://dje.tjmt.jus.br/publicacoes/"+str(edicao)+"-2020%20CADERNO%20JUDICIAL%20DO%20TRIBUNAL%20DE%20JUSTICA.pdf" downloadFile(fileUrl,nomeArquivo,e) print("Download:"+nomeArquivo) date = date + np.timedelta64(1,'D') print("Arquivos Baixados")
def SantaCatarina(self): self.__log("Data de inicio e fim da pesquisa:","green") dataInit,dataFim = self.__askDate() start = np.datetime64(dataInit) end = np.datetime64(dataFim) e='SC' date =start cadernos = ['1','2','3','4'] while date <= end: dia = str(date).rsplit('-')[2] mes = str(date).rsplit('-')[1] ano = str(date).rsplit('-')[0] strDia = dia+"/"+mes+"/"+ano url = "http://busca.tjsc.jus.br/dje-consulta/rest/diario/dia?dia="+strDia result = requests.get(url) resultJson = result.json() try: edicao = str(resultJson[str(date)][0]['edicao']) except KeyError: edicao = None if edicao != None: for c in cadernos: try: fileUrl = "http://busca.tjsc.jus.br/dje-consulta/rest/diario/caderno?edicao="+edicao+"&cdCaderno="+c nomeArquivo = "Diario-"+str(date)+"-caderno-"+c+".pdf" diretorio = e+"/"+"caderno "+c downloadFile(fileUrl,nomeArquivo,diretorio) print("Download:"+nomeArquivo) except: raise date = date + np.timedelta64(1,'D') print("Arquivos Baixados")
def Piaui(self): holidays2020 = np.array(['2020-01-01','2020-01-02','2020-01-03','2020-01-04','2020-01-05','2020-05-15','2020-01-06','2020-02-03','2020-02-10','2020-02-24','2020-02-25','2020-04-09','2020-04-10','2020-04-17','2020-04-21','2020-05-01','2020-05-20','2020-08-11','2020-09-07','2020-10-12','2020-11-02','2020-11-15','2020-12-24','2020-12-25','2020-12-30'],dtype='datetime64') self.__log("Data de inicio e fim da pesquisa:","green") dataInit,dataFim = self.__askDate() start = np.datetime64(dataInit) end = np.datetime64(dataFim) date = start e='PI' iniAno = np.datetime64('2020-01-01') while date <= end: dia = str(date).rsplit('-')[2] mes = str(date).rsplit('-')[1] ano = str(date).rsplit('-')[0] ano = ano[2]+ano[3] dateStr = ano+mes+dia if np.is_busday(date,holidays=holidays2020): edicao = 8819 + np.busday_count(iniAno,date + np.timedelta64(1,'D'),holidays=holidays2020) edicaoStr = "dj" + dateStr + "_" + str(edicao) nomeArquivo = "Diario-"+edicaoStr+".pdf" fileUrl = "http://www.tjpi.jus.br/diarioeletronico/public/"+edicaoStr+".pdf" downloadFile(fileUrl,nomeArquivo,e) print("Download:"+nomeArquivo) date = date + np.timedelta64(1,'D') print("Arquivos Baixados")
def RioGrandeDoSul(self): holidays2020 = np.array(['2020-01-01','2020-02-24','2020-02-25','2020-04-10','2020-04-21','2020-05-01','2020-06-11','2020-06-12','2020-09-07','2020-09-20','2020-10-12','2020-11-02','2020-11-15','2020-11-20','2020-12-08','2020-12-24','2020-12-25','2020-12-30'],dtype='datetime64') cadernos = ['0','5','7','6','8'] self.__log("Data de inicio e fim da pesquisa:","green") dataInit,dataFim = self.__askDate() start = np.datetime64(dataInit) end = np.datetime64(dataFim) date = start e='RS' while date <= end: if np.is_busday(date,holidays=holidays2020): edicao = self.__EdicaoRS(date) for c in cadernos: nomeArquivo = "Diario-"+str(date)+"caderno-"+c+".pdf" fileUrl ="https://www.tjrs.jus.br/servicos/diario_justica/download_edicao.php?tp="+c+"&ed="+edicao diretorio = e+"/"+c downloadFile(fileUrl,nomeArquivo,diretorio) print("Download:"+nomeArquivo) date = date + np.timedelta64(1,'D') print("Arquivos Baixados")
class Estados(object): def estado(self,argument): method_name = argument method = getattr(self,method_name, lambda : "Estado invalido") return method() def Alagoas(self): holidays2020 = np.array(['2020-01-01','2020-02-24','2020-02-25','2020-02-26','2020-04-08','2020-04-09','2020-04-10','2020-04-21','2020-05-01','2020-06-11','2020-06-24','2020-06-29','','2020-09-07','2020-09-16','2020-10-12','2020-10-28','2020-11-02','2020-11-15','2020-11-20','2020-11-30','2020-12-8','2020-12-24','2020-12-25','2020-12-30'],dtype='datetime64') self.__log("Data de inicio e fim da pesquisa:","green") dataInit,dataFim = self.__askDate() start = np.datetime64(dataInit) end = np.datetime64(dataFim) date = start e='AL' while date <= end: dia = str(date).rsplit('-')[2] mes = str(date).rsplit('-')[1] ano = str(date).rsplit('-')[0] dateStr = dia+"/"+mes+"/"+ano if np.is_busday(date,holidays=holidays2020): nomeArquivo = "Diario-"+str(date)+".pdf" fileUrl = "https://www2.tjal.jus.br/cdje/downloadCaderno.do?dtDiario="+dateStr+"&cdCaderno=3&tpDownload=D" downloadFile(fileUrl,nomeArquivo,e) print("Download:"+nomeArquivo) date = date + np.timedelta64(1,'D') print("Arquivos Baixados") def Acre(self): return "Não Implementado" def Amazonas(self): holidays2020 = np.array(['2020-01-01','2020-02-24','2020-02-25','2020-02-26','2020-04-08','2020-04-09','2020-04-10','2020-04-21','2020-05-01','2020-06-11','2020-06-24','2020-06-29','','2020-09-07','2020-09-16','2020-10-12','2020-10-28','2020-11-02','2020-11-15','2020-11-20','2020-11-30','2020-12-08','2020-12-24','2020-12-25','2020-12-30'],dtype='datetime64') self.__log("Data de inicio e fim da pesquisa:","green") dataInit,dataFim = self.__askDate() start = np.datetime64(dataInit) end = np.datetime64(dataFim) e='AM' date =start while date <= end: dia = str(date).rsplit('-')[2] mes = str(date).rsplit('-')[1] ano = str(date).rsplit('-')[0] dateStr = dia+"/"+mes+"/"+ano if np.is_busday(date,holidays=holidays2020): nomeArquivo = "Diario-"+str(date)+".pdf" fileUrl = "https://consultasaj.tjam.jus.br/cdje/downloadCaderno.do?dtDiario="+dateStr+"&cdCaderno=2&tpDownload=D" downloadFile(fileUrl,nomeArquivo,e) print("Download:"+nomeArquivo) date = date + np.timedelta64(1,'D') print("Arquivos Baixados") def Bahia(self): pass def Ceara(self): holidays2020 = np.array(['2020-01-01','2020-02-24','2020-02-25','2020-02-26','2020-03-19','2020-03-25','2020-04-09','2020-04-10','2020-04-13','2020-04-21','2020-05-01','2020-05-27','2020-05-28','2020-09-07','2020-10-12','2020-11-02','2020-11-15','2020-12-24','2020-12-25','2020-12-30'],dtype='datetime64') self.__log("Data de inicio e fim da pesquisa:","green") dataInit,dataFim = self.__askDate() start = np.datetime64(dataInit) end = np.datetime64(dataFim) date = start e='CE' while date <= end: dia = str(date).rsplit('-')[2] mes = str(date).rsplit('-')[1] ano = str(date).rsplit('-')[0] dateStr = dia+"/"+mes+"/"+ano if np.is_busday(date,holidays=holidays2020): nomeArquivo = "Diario-"+str(date)+".pdf" fileUrl = "https://esaj.tjce.jus.br/cdje/downloadCaderno.do?dtDiario="+dateStr+"&cdCaderno=2&tpDownload=D" downloadFile(fileUrl,nomeArquivo,e) print("Download:"+nomeArquivo) date = date + np.timedelta64(1,'D') print("Arquivos Baixados") def DistritoFederal(self): iniAno = np.datetime64('2020-01-01') holidays2020 = np.array(['2020-01-01','2020-02-24','2020-02-25','2020-02-26','2020-04-08','2020-04-09','2020-04-10','2020-04-21','2020-05-01','2020-06-11','2020-08-11','2020-09-07','2020-10-12','2020-10-28','2020-11-02','2020-11-15','2020-11-20','2020-11-30','2020-12-24','2020-12-25','2020-12-30'],dtype='datetime64') self.__log("Data de inicio e fim da pesquisa:","green") dataInit,dataFim = self.__askDate() start = np.datetime64(dataInit) end = np.datetime64(dataFim) edicaoInicial = np.busday_count(iniAno,start,weekmask= [1,1,1,1,1,0,0],holidays=holidays2020) edicaoFinal = np.busday_count(iniAno,end,holidays=holidays2020) e='DF' for i in range(edicaoInicial,edicaoFinal+1): num = i+1 fileUrl = "https://pesquisadje-api.tjdft.jus.br/v1/diarios/pdf/2020/"+str(num)+".pdf" nomeArquivo = "Diario-"+str(num)+".pdf" downloadFile(fileUrl,nomeArquivo,e) print("Download:"+nomeArquivo) print("Arquivos Baixados")