-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'homologacao' into banch_jp
- Loading branch information
Showing
4 changed files
with
60 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters