This repository was archived by the owner on Apr 20, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPyGetterConsole.py
More file actions
76 lines (69 loc) · 2.16 KB
/
PyGetterConsole.py
File metadata and controls
76 lines (69 loc) · 2.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
import requests
import json
import os
import urllib.request
liste = requests.get('https://api.lxndr.live/pygetter/listener.php')
listener=json.loads(json.dumps(liste.json()))
print('\n')
for item in listener['entries']:
id = (item['id'])
autor = (item['autor'])
url = (item['url'])
filename = (item['filename'])
print(id+'.- '+filename+'\n\tDe: '+autor+'\n')
sel = int(input('Ingrese el id del archivo: '))
sel = str(sel)
re = requests.get('https://api.lxndr.live/pygetter?id='+sel)
dict_json=json.loads(json.dumps(re.json()))
error = dict_json["id"]
url = dict_json["url"]
autor = dict_json["author"]
fp = urllib.request.urlopen(url)
mybytes = fp.read()
mystr = mybytes.decode("utf8")
fp.close()
if error=='error':
print('\nEl archivo no existe')
os.system("PAUSE")
exit()
lectura = input('Desea leer el archivo? (S/N): ')
lectura = lectura.lower()
while (lectura !='s' and lectura !='n'):
print('Ingrese una opción válida')
lectura = input('Desea leer el archivo? (S/N): ')
lectura = lectura.lower()
if(lectura=='s'):
print('\n------INICIA CÓDIGO------\n')
print(mystr)
print('\n------TERMINA CÓDIGO------')
print('\n\n\tAutor: ',autor)
os.system("PAUSE")
exit()
else:
save = input('Desea guardar el archivo? (S/N): ')
save = save.lower()
while (save !='s' and save !='n'):
print('Ingrese una opción válida')
save = input('Desea guardar el archivo? (S/N): ')
save = save.lower()
if(save=='s'):
with open('files/'+filename, "wb") as f:
f.write(mybytes)
f.close()
print('Archivo Guardado :)')
os.system("PAUSE")
else:
exe = input('Desea ejecutar el archivo? (S/N): ')
exe = exe.lower()
while (exe !='s' and exe !='n'):
print('Ingrese una opción válida')
exe = input('Desea ejecutar el archivo? (S/N): ')
exe = exe.lower()
if(exe=='s'):
print('\n------INICIA EJECUCIÓN------\n')
exec(mystr)
print('\n------TERMINA EJECUCIÓN------')
os.system("PAUSE")
else:
print('\nFin del programa')
exit()