Skip to content

Commit

Permalink
Merge branch 'homologacao' into banch_jp
Browse files Browse the repository at this point in the history
  • Loading branch information
jpmondoni authored Feb 26, 2018
2 parents eab42e8 + bf7cddb commit 1abb817
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 2 deletions.
3 changes: 3 additions & 0 deletions Dependências.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@
* mysql-connector-python 2.0.4
* Conda: `conda install -c anaconda mysql-connector-python `
* pip: `pip install mysql-connector`
* lxml
* pip: `pip install lxml`
49 changes: 49 additions & 0 deletions Modulos/ProvasPassadas/aux_scraping.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#ASAPY
import requests
__URL_GLOBAL = "https://www.urionlinejudge.com.br";

def printme(pagina):
body = getCorpo(__URL_GLOBAL+"/judge/pt/problems/view/"+pagina);
iInicio = find_str(body, "<iframe");
pos = (body[iInicio:]);
iFim = find_str(pos, ">")+1;
tupla = pos[:iFim];
page2 = getAttr(tupla,"src");

bodyframe = getCorpo(__URL_GLOBAL+page2);
print(bodyframe);

return;


def find_str(s, char):
index = 0
if char in s:
c = char[0]
for ch in s:
if ch == c:
if s[index:index+len(char)] == char:
return index
index += 1
return -1

#TODO - TRATAR EQUIVALENCIA DE SINTAXE !
def getAttr(tupla, atributo):
tamanhoAtr = len(atributo)+2; #ja apaga atributo="
inicioAtr = find_str(tupla, atributo)+tamanhoAtr;
if inicioAtr == -1:
return "ERRO"
fimAttr = find_str(tupla[inicioAtr:], '"');
return tupla[inicioAtr:inicioAtr+fimAttr];

def getCorpo(req):
page = requests.get(req);
return str(page.content);


printme("2166")


#print("titulo => URI Online Judge - Problema 2166 - Raiz Quadrada de 2")
#print("autor => M.C. Pinto, UNILA")
#print("probm => ma das formas de calcular a raiz quadrada de um n\xc3\xbamero natural")
7 changes: 7 additions & 0 deletions Modulos/ProvasPassadas/provas_passadas.core.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import requests
printme(2661)
# retorna corpo da pagina
def printme(id):
page = requests.get("https://www.urionlinejudge.com.br/judge/pt/problems/view/"+id);
print(page.content);
return;
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,4 @@ Confira os releases no branch `master` do projeto, em [releases](https://github.

* Bugs, erros ou suporte

Crie um novo `issue` em nosso repositório: [Issues](https://github.com/gabrielfava/asapy/issues).

Crie um novo `issue` em nosso repositório: [Issues](https://github.com/gabrielfava/asapy/issues).

0 comments on commit 1abb817

Please sign in to comment.