Closed FreeM1ne closed 3 months ago
@FreeM1ne Can you provide an example for the usage for each of the functions?
Here is an example of a netscape cookie that we convert to json format And then we convert the json cookies into chrome format. you also need a transformer if the cookies are already in json format, but the keys are not suitable for chrome. This is necessary to be able to load any cookies, not only those that were created in browsers and then saved. NetScapeCookie.txt
Here is an example of a netscape cookie that we convert to json format And then we convert the json cookies into chrome format.
Oh right - soo netscape
=> the format chrome uses to parse cookies for Set-Cookie
and Cookie
headers I suppose? Didn't really realize that.
You also need a transformer if the cookies are already in json format, but the keys are not suitable for chrome. This is necessary to be able to load any cookies, not only those that were created in browsers and then saved.
Soo basically, we need a value for expires?
or is the line chrome_transformer = {"exp": "expires"}
just representative? If yes, how would an example look? {"expires":int}
?
At thid point (for request interception), I suppose having a json cookie to netscape cookie parser function would be nice as well.
Netscape is a cookie storage format. Since you only support the original cookie loading format, I thought I should add more formats. Netscape is a very commonly used cookie format. Netscape to json turns netscape into the familiar json.
CookieTransformer is needed as an additional function to change the json cookie format. Conditionally we have a cookie in which instead of "expires" the key is called "expirationDate", in the cookie transformer a person passes a dictionary of keys that should be changed to another key For the example I took the pair "expir" and "expires" because the function does not work by exact comparison It's very difficult to explain
"At thid point (for request interception), I suppose having a json cookie to netscape cookie parser function would be nice as well." I'm not quite sure what you mean
I get your point, yes chrome uses them in that format to send them to headers, but I didn't make those functions for queries, but to simplify importing cookies
Let's leave that parsing up to the user, as I'm still not 100% sure about how this would be used etc.
@FreeM1ne Feel free to open a PR tho
Sharing two functions netscape to json and cookie_transformer cookie transformer is needed if you already have cookies in json format, but not in the format you need I don't know how to create commits or pull requests