mirror of
https://github.com/xtekky/gpt4free.git
synced 2024-11-27 13:42:19 +03:00
make user agent easily changeable in deepai
This commit is contained in:
parent
e049176324
commit
a77848429e
@ -22,9 +22,10 @@ class DeepAi(AsyncGeneratorProvider):
|
|||||||
proxy: str = None,
|
proxy: str = None,
|
||||||
**kwargs
|
**kwargs
|
||||||
) -> AsyncResult:
|
) -> AsyncResult:
|
||||||
|
agent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36"
|
||||||
|
|
||||||
token_js = """
|
token_js = """
|
||||||
var agent = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36'
|
var agent = '""" + agent + """'
|
||||||
var a, b, c, d, e, h, f, l, g, k, m, n, r, x, C, E, N, F, T, O, P, w, D, G, Q, R, W, I, aa, fa, na, oa, ha, ba, X, ia, ja, ka, J, la, K, L, ca, S, U, M, ma, B, da, V, Y;
|
var a, b, c, d, e, h, f, l, g, k, m, n, r, x, C, E, N, F, T, O, P, w, D, G, Q, R, W, I, aa, fa, na, oa, ha, ba, X, ia, ja, ka, J, la, K, L, ca, S, U, M, ma, B, da, V, Y;
|
||||||
h = Math.round(1E11 * Math.random()) + "";
|
h = Math.round(1E11 * Math.random()) + "";
|
||||||
f = function() {
|
f = function() {
|
||||||
@ -52,7 +53,7 @@ f = function() {
|
|||||||
api_key = js2py.eval_js(token_js)
|
api_key = js2py.eval_js(token_js)
|
||||||
headers = {
|
headers = {
|
||||||
"api-key": api_key,
|
"api-key": api_key,
|
||||||
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36",
|
"User-Agent": agent,
|
||||||
**kwargs.get("headers", {})
|
**kwargs.get("headers", {})
|
||||||
}
|
}
|
||||||
async with ClientSession(
|
async with ClientSession(
|
||||||
|
Loading…
Reference in New Issue
Block a user