Open PythonX-001 opened 9 months ago
@PythonX-001 @NotCookey It seems that the format of their backend api has changed, I tried to track it but I still don’t understand the reason.
The endpoint itself has changed from https://z.lexica.art/api/generator
to https://lexica.art/api/generator
And it seems that payload has a new parameter s
that is some kind of secret key string.
@NotCookey
I spent several hours fiddling around with reverse engineering. So far no success. I tried repeating one-to-one session
GET and generate
POST requests using curl (copied requests, headers and payloads from Chrome Developer Tools), with passing cookies but it didn’t work. In the best case it gives the response with text message refresh the page and try again
on generate
request. I will be glad if you try it too and say something, to be honest, I’m not a big expert in web queries.
@NotCookey
I spent several hours fiddling around with reverse engineering. So far no success. I tried repeating one-to-one
session
GET andgenerate
POST requests using curl (copied requests, headers and payloads from Chrome Developer Tools), with passing cookies but it didn’t work. In the best case it gives the response with text messagerefresh the page and try again
ongenerate
request. I will be glad if you try it too and say something, to be honest, I’m not a big expert in web queries.
Hey @dimaischenko , thanks for digging into this! Turns out the API revamped its encryption logic, making user access a no-go. Personal stuff kept me swamped, but I'm free after tomorrow to check their new logic. Thank you for giving your time to look into this!
I spent a few hours with this but no sucess. Please update us if there's any development, this is very interesting! Thank you
Looks like they've added more security. But in general there should be an approach that would allow generating, we just need to better understand web requests 🤔
In general it’s strange that they themselves don’t provide an official API, that would be cool.
I found the logic behind the webapp's new security system but it seems they removed the free trial generation so I can't test to see if it works. Let me find some workarounds.
@NotCookey Hey-hey, no chance?
@NotCookey Hey-hey, no chance?
I've tired but apparently I can't seem to get access to the generator so I can't really check if the new code works. They have the subscription thing they prevents people for trying it for free.
@NotCookey if you want i can share my account with you for testing
@NotCookey if you want i can share my account with you for testing
That would be a big help, I'm open to collaborations but currently I'm a little inactive for this project due to some personal stuffs. I will get back to this soon but till then i will provide the resources I've found and extracted from the site.
Opening inspect tool and go to sources
tab and then if you expand __next/static
->chunks
->app
->aperture
then open the js file starting with page-3db
and search for b = {
you will find that codeblock that makes the request and it has most of the logic. You can try tracing back where the logic comes from aka the functions that provide the value most of it is already in this repos script all we need is the new values like s
, sourceActions
, etc.
That would be a big help, I'm open to collaborations but currently I'm a little inactive for this project due to some personal stuffs.
Nice! Thank you! I'll try to figure it out soon, if it works out I'll make a pull request
I can't figure out how to get s
is some variable value that is obtained by encrypt
function, which in turn depends on some other function imported from outside. Not easy 🤔
And in general, it seems that Lexica project is "frozen". In their Discord in all channels in the latest messages people ask to add API, but all messages without response.
I can't figure out how to get
s
is some variable value that is obtained byencrypt
function, which in turn depends on some other function imported from outside. Not easy 🤔
Thank you for trying out. At this point I've realized lexica was once an usable free to generate site with now it went entirely paid so I don't think there would be much point in making an api for it. I checked the encrypt function and traced it back to different files where everything is from a function that is a
. But honestly the userbase of lexica is mostly paid and I'm thinking of reverse engineering an entirely different ai that offers thousands and not just some exclusive models.
Traceback (most recent call last): File "e:\FILES\Documents\Web-Dev-Project\Chat-Bot\api\test2.py", line 5, in
lex = Lexica(query="icecream",cookie=cookie).generate()
File "e:\FILES\Documents\Web-Dev-Project\Chat-Bot\api\Lex.py", line 50, in generate
return [f"https://image.lexica.art/full_jpg/{ids['id']}" for ids in response.json()["images"]]
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site-packages\httpx_models.py", line 756, in json
return jsonlib.loads(self.text, **kwargs)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\json__init__.py", line 346, in loads
return _default_decoder.decode(s) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\json\decoder.py", line 355, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)