Spaces:
Runtime error
Runtime error
Commit
·
e9fc591
1
Parent(s):
d4a847b
Update app.py
Browse files
app.py
CHANGED
@@ -42,14 +42,15 @@ def dencrypt(text):
|
|
42 |
|
43 |
def NewAccount():
|
44 |
# Genrate CSRF
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
response =
|
50 |
-
|
|
|
51 |
print("CSRF :", csrf)
|
52 |
-
cookies = response.
|
53 |
|
54 |
# Genrate Temp Mail
|
55 |
tempEmail = json.loads(requests.get(
|
@@ -69,10 +70,10 @@ def NewAccount():
|
|
69 |
'Content-Type': 'application/x-www-form-urlencoded',
|
70 |
'Cookie': cookiesText
|
71 |
}
|
72 |
-
|
73 |
-
|
74 |
-
response = requests.post("https://api.zenrows.com/v1/?apikey="+APIKEY+"&url=https://lexica.art/api/auth/signin/email?=null", json=payload,headers=headers)
|
75 |
-
if ("provider=email&type=email" in response.
|
76 |
print("Email Sent :", True)
|
77 |
|
78 |
# Recieve Mail from Lexica
|
@@ -94,10 +95,10 @@ def NewAccount():
|
|
94 |
headers = {
|
95 |
'Cookie': cookiesText
|
96 |
}
|
97 |
-
#
|
98 |
-
|
99 |
-
|
100 |
-
data =
|
101 |
cookies = res.getheader("Set-Cookie")
|
102 |
print(data.decode("utf-8"))
|
103 |
print(cookies)
|
@@ -151,12 +152,12 @@ def infiniteScroll(cursor, query, searchMode, model):
|
|
151 |
'Content-Type': 'application/json',
|
152 |
'Cookie': '__Host-next-auth.csrf-token='+csrfTokenCookie+'; __Secure-next-auth.callback-url=https%3A%2F%2Flexica.art'
|
153 |
}
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
response = requests.post("https://api.zenrows.com/v1/?apikey="+APIKEY+"&url=https://lexica.art/api/infinite-prompts",headers=headers, json=payload)
|
158 |
-
|
159 |
-
return json.loads(response.text)
|
160 |
|
161 |
|
162 |
@app.route('/infinite-prompts', methods=["POST", "GET"])
|
@@ -239,7 +240,7 @@ def diffuser():
|
|
239 |
res = conn.getresponse()
|
240 |
data = res.read()
|
241 |
#response = requests.post("https://z.lexica.art/api/generator",headers=headers, json=payload)
|
242 |
-
if "needsMembership" in
|
243 |
csrfTokenCookieGEN, sessionTokenCookieGEN = NewAccount()
|
244 |
visitorId = SG("[\l\d]{20}").render_list(1, unique=True)[0]
|
245 |
json_object = json.dumps({"csrfTokenCookieGEN": csrfTokenCookieGEN,"sessionTokenCookieGEN": sessionTokenCookieGEN, "visitorId": visitorId}, indent=4)
|
@@ -248,14 +249,14 @@ def diffuser():
|
|
248 |
data = {"error": "Please try Again"}
|
249 |
return jsonify(data)
|
250 |
try:
|
251 |
-
images = json.loads(data)["images"]
|
252 |
with open("images.txt", "a", encoding="utf-8") as file1:
|
253 |
for img in images:
|
254 |
file1.write(str(img["url"]+"\n"))
|
255 |
file1.close()
|
256 |
except:
|
257 |
pass
|
258 |
-
return jsonify(
|
259 |
except Exception as e:
|
260 |
return jsonify({"error": str(e)})
|
261 |
else:
|
|
|
42 |
|
43 |
def NewAccount():
|
44 |
# Genrate CSRF
|
45 |
+
conn = http.client.HTTPSConnection("lexica.art")
|
46 |
+
payload = ''
|
47 |
+
conn.request("GET", "/api/auth/csrf", payload)
|
48 |
+
responseobj = conn.getresponse()
|
49 |
+
response = responseobj.read()
|
50 |
+
#response = requests.post("https://api.zenrows.com/v1/?apikey="+APIKEY+"&url=https://lexica.art/api/auth/csrf", json={})
|
51 |
+
csrf = json.loads(response.read().decode("utf-8"))["csrfToken"]
|
52 |
print("CSRF :", csrf)
|
53 |
+
cookies = response.getheader("Set-Cookie")
|
54 |
|
55 |
# Genrate Temp Mail
|
56 |
tempEmail = json.loads(requests.get(
|
|
|
70 |
'Content-Type': 'application/x-www-form-urlencoded',
|
71 |
'Cookie': cookiesText
|
72 |
}
|
73 |
+
conn.request("POST", "/api/auth/signin/email?=null", payload, headers)
|
74 |
+
response = conn.getresponse()
|
75 |
+
#response = requests.post("https://api.zenrows.com/v1/?apikey="+APIKEY+"&url=https://lexica.art/api/auth/signin/email?=null", json=payload,headers=headers)
|
76 |
+
if ("provider=email&type=email" in response.read().decode("utf-8")):
|
77 |
print("Email Sent :", True)
|
78 |
|
79 |
# Recieve Mail from Lexica
|
|
|
95 |
headers = {
|
96 |
'Cookie': cookiesText
|
97 |
}
|
98 |
+
#response = requests.post("https://api.zenrows.com/v1/?apikey="+APIKEY+"&url=https://lexica.art/"+sessionLink.split("lexica.art/")[1], json=payload,headers=headers)
|
99 |
+
conn.request("GET", "/"+sessionLink.split("lexica.art/")[1], payload, headers)
|
100 |
+
res = conn.getresponse()
|
101 |
+
data = res.read()
|
102 |
cookies = res.getheader("Set-Cookie")
|
103 |
print(data.decode("utf-8"))
|
104 |
print(cookies)
|
|
|
152 |
'Content-Type': 'application/json',
|
153 |
'Cookie': '__Host-next-auth.csrf-token='+csrfTokenCookie+'; __Secure-next-auth.callback-url=https%3A%2F%2Flexica.art'
|
154 |
}
|
155 |
+
conn.request("POST", "/api/infinite-prompts", payload, headers)
|
156 |
+
res = conn.getresponse()
|
157 |
+
data = res.read()
|
158 |
+
#response = requests.post("https://api.zenrows.com/v1/?apikey="+APIKEY+"&url=https://lexica.art/api/infinite-prompts",headers=headers, json=payload)
|
159 |
+
return json.loads(data.decode("utf-8"))
|
160 |
+
#return json.loads(response.text)
|
161 |
|
162 |
|
163 |
@app.route('/infinite-prompts', methods=["POST", "GET"])
|
|
|
240 |
res = conn.getresponse()
|
241 |
data = res.read()
|
242 |
#response = requests.post("https://z.lexica.art/api/generator",headers=headers, json=payload)
|
243 |
+
if "needsMembership" in data.decode("utf-8"):
|
244 |
csrfTokenCookieGEN, sessionTokenCookieGEN = NewAccount()
|
245 |
visitorId = SG("[\l\d]{20}").render_list(1, unique=True)[0]
|
246 |
json_object = json.dumps({"csrfTokenCookieGEN": csrfTokenCookieGEN,"sessionTokenCookieGEN": sessionTokenCookieGEN, "visitorId": visitorId}, indent=4)
|
|
|
249 |
data = {"error": "Please try Again"}
|
250 |
return jsonify(data)
|
251 |
try:
|
252 |
+
images = json.loads(data.decode("utf-8"))["images"]
|
253 |
with open("images.txt", "a", encoding="utf-8") as file1:
|
254 |
for img in images:
|
255 |
file1.write(str(img["url"]+"\n"))
|
256 |
file1.close()
|
257 |
except:
|
258 |
pass
|
259 |
+
return jsonify(data.decode("utf-8"))
|
260 |
except Exception as e:
|
261 |
return jsonify({"error": str(e)})
|
262 |
else:
|