XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet
公开
关注 0 Fork 0 Star 1
返回提交历史

XFEstudio/gpt4free

fix(g4f/Provider/MagickPen.py): update API credentials fetching URL

96035435
kqlio67 <kqlio67@users.noreply.github.com>
提交于

代码差异

1 个文件 +2 -5
Modified g4f/Provider/MagickPen.py +2 -5
@@ -24,21 +24,18 @@ class MagickPen(AsyncGeneratorProvider, ProviderModelMixin):
24 24
25 25 @classmethod
26 26 async def fetch_api_credentials(cls) -> tuple:
27 url = "https://magickpen.com/_nuxt/9e47cd7579e60a9d1f13.js"
27 url = "https://magickpen.com/_nuxt/bf709a9ce19f14e18116.js"
28 28 async with ClientSession() as session:
29 29 async with session.get(url) as response:
30 30 text = await response.text()
31 31
32 # Extract the necessary values from the file
33 32 pattern = r'"X-API-Secret":"(\w+)"'
34 33 match = re.search(pattern, text)
35 34 X_API_SECRET = match.group(1) if match else None
36 35
37 # Generate timestamp and nonce
38 timestamp = str(int(time.time() * 1000)) # in milliseconds
36 timestamp = str(int(time.time() * 1000))
39 37 nonce = str(random.random())
40 38
41 # Generate the signature
42 39 s = ["TGDBU9zCgM", timestamp, nonce]
43 40 s.sort()
44 41 signature_string = ''.join(s)