make user agent easily changeable in deepai

This commit is contained in:
Commenter123321 2023-10-10 15:21:38 +02:00
parent e049176324
commit a77848429e

View File

@ -22,9 +22,10 @@ class DeepAi(AsyncGeneratorProvider):
proxy: str = None,
**kwargs
) -> 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 = """
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;
h = Math.round(1E11 * Math.random()) + "";
f = function() {
@ -52,7 +53,7 @@ f = function() {
api_key = js2py.eval_js(token_js)
headers = {
"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", {})
}
async with ClientSession(