yihong0618 / klingCreator

About High quality video and image generation by https://klingai.kuaishou.com and https://klingai.com/ Reverse engineered API.
GNU General Public License v3.0
110 stars 25 forks source link

Q: Any idea on Cookie TTL? #16

Open useapi opened 2 months ago

useapi commented 2 months ago

We're about to add support for Kling in addition to the already supported Runway, but we have not been able (so far) to reverse-engineer Kling's cookie format. Do you have any details by any chance? Or perhaps know from experience the Cookie actual TTL?

It appears that at least userId set to expire in 21 days:

POST https://id.klingai.com/pass/ksi18n/web/login/emailPassword
Set-Cookie: userId=…; Path=/; Domain=klingai.com; Max-Age=1814400; Expires=…; Secure; SameSite=None

On a side note, we're thinking of creating a Puppeteer script to initiate login and grab a fresh cookie every XX days, and we're planning to make it public since this will be the only way it can be maintained up-to-date. Let me know if you're interested.

PS Kudos on your project, solid effort 👍

jochemstoel commented 2 months ago

I was considering writing this puppeteer script as well. Do you already have it? Do you want to share? If not, do you need me to write it? @useapi

yihong0618 commented 2 months ago

PR welcome

useapi commented 2 months ago

I was considering writing this puppeteer script as well. Do you already have it? Do you want to share? If not, do you need me to write it? @useapi

We will release the API first before adding the login script. It is not clear at this moment how much interest the Kling API will generate compared to our current Runway API offering, so we will have to wait and see.

In the past, we've successfully used free GCP cloud functions running a 1024MB Node.js script to launch Chromium and solve CAPTCHAs ad hock. I believe we used Playwright as it was leaner and had better features vs Puppeteer but I'm not entirely sure. Anyway, it worked very well, scaled indefinitely when needed, and cost us nothing. This https://github.com/Sparticuz/chromium is what we've used afaik. Let me know if you need more details, I can send you our old project to get you going.

raymerjacque commented 2 months ago

I was considering writing this puppeteer script as well. Do you already have it? Do you want to share? If not, do you need me to write it? @useapi

We will release the API first before adding the login script. It is not clear at this moment how much interest the Kling API will generate compared to our current Runway API offering, so we will have to wait and see.

In the past, we've successfully used free GCP cloud functions running a 1024MB Node.js script to launch Chromium and solve CAPTCHAs ad hock. I believe we used Playwright as it was leaner and had better features vs Puppeteer but I'm not entirely sure. Anyway, it worked very well, scaled indefinitely when needed, and cost us nothing. This https://github.com/Sparticuz/chromium is what we've used afaik. Let me know if you need more details, I can send you our old project to get you going.

ill skip runway, too expensive. ill wait for the kling api.

jochemstoel commented 1 month ago

@useapi Thanks it is nice of you to offer but I don't need the old project file(s) and I am not interested in Runway.