2023-09-03 11:26:26 +03:00
|
|
|
from __future__ import annotations
|
2023-07-28 13:07:17 +03:00
|
|
|
|
2023-09-05 18:27:24 +03:00
|
|
|
import random, string, time
|
|
|
|
from aiohttp import ClientSession
|
2023-09-03 11:26:26 +03:00
|
|
|
|
2023-10-04 08:20:51 +03:00
|
|
|
from ..base_provider import AsyncProvider
|
2023-09-03 11:26:26 +03:00
|
|
|
|
2023-07-28 13:07:17 +03:00
|
|
|
|
2023-09-05 18:27:24 +03:00
|
|
|
class Wewordle(AsyncProvider):
|
|
|
|
url = "https://wewordle.org"
|
2023-10-01 11:36:09 +03:00
|
|
|
working = False
|
2023-08-27 18:37:44 +03:00
|
|
|
supports_gpt_35_turbo = True
|
2023-07-28 13:07:17 +03:00
|
|
|
|
2023-08-24 22:32:22 +03:00
|
|
|
@classmethod
|
2023-09-05 18:27:24 +03:00
|
|
|
async def create_async(
|
2023-08-24 22:32:22 +03:00
|
|
|
cls,
|
2023-07-28 13:07:17 +03:00
|
|
|
model: str,
|
|
|
|
messages: list[dict[str, str]],
|
2023-09-05 18:27:24 +03:00
|
|
|
proxy: str = None,
|
|
|
|
**kwargs
|
|
|
|
) -> str:
|
2023-08-27 18:37:44 +03:00
|
|
|
|
2023-07-28 13:07:17 +03:00
|
|
|
headers = {
|
2023-08-27 18:37:44 +03:00
|
|
|
"accept" : "*/*",
|
|
|
|
"pragma" : "no-cache",
|
|
|
|
"Content-Type" : "application/json",
|
|
|
|
"Connection" : "keep-alive"
|
2023-07-28 13:07:17 +03:00
|
|
|
}
|
2023-09-05 18:27:24 +03:00
|
|
|
|
|
|
|
_user_id = "".join(random.choices(f"{string.ascii_lowercase}{string.digits}", k=16))
|
|
|
|
_app_id = "".join(random.choices(f"{string.ascii_lowercase}{string.digits}", k=31))
|
|
|
|
_request_date = time.strftime("%Y-%m-%dT%H:%M:%S.000Z", time.gmtime())
|
|
|
|
data = {
|
2023-08-27 18:37:44 +03:00
|
|
|
"user" : _user_id,
|
|
|
|
"messages" : messages,
|
2023-07-28 13:07:17 +03:00
|
|
|
"subscriber": {
|
2023-08-27 18:37:44 +03:00
|
|
|
"originalPurchaseDate" : None,
|
|
|
|
"originalApplicationVersion" : None,
|
|
|
|
"allPurchaseDatesMillis" : {},
|
|
|
|
"entitlements" : {"active": {}, "all": {}},
|
|
|
|
"allPurchaseDates" : {},
|
|
|
|
"allExpirationDatesMillis" : {},
|
|
|
|
"allExpirationDates" : {},
|
|
|
|
"originalAppUserId" : f"$RCAnonymousID:{_app_id}",
|
|
|
|
"latestExpirationDate" : None,
|
|
|
|
"requestDate" : _request_date,
|
|
|
|
"latestExpirationDateMillis" : None,
|
|
|
|
"nonSubscriptionTransactions" : [],
|
|
|
|
"originalPurchaseDateMillis" : None,
|
|
|
|
"managementURL" : None,
|
2023-07-28 13:07:17 +03:00
|
|
|
"allPurchasedProductIdentifiers": [],
|
2023-08-27 18:37:44 +03:00
|
|
|
"firstSeen" : _request_date,
|
|
|
|
"activeSubscriptions" : [],
|
|
|
|
}
|
2023-07-28 13:07:17 +03:00
|
|
|
}
|
|
|
|
|
2023-09-05 18:27:24 +03:00
|
|
|
|
|
|
|
async with ClientSession(
|
|
|
|
headers=headers
|
|
|
|
) as session:
|
|
|
|
async with session.post(f"{cls.url}/gptapi/v1/android/turbo", proxy=proxy, json=data) as response:
|
|
|
|
response.raise_for_status()
|
|
|
|
content = (await response.json())["message"]["content"]
|
|
|
|
if content:
|
|
|
|
return content
|