2023-09-03 08:26:26 +00:00
|
|
|
from __future__ import annotations
|
2023-07-28 10:07:17 +00:00
|
|
|
|
2023-09-05 15:27:24 +00:00
|
|
|
import random, string, time
|
|
|
|
from aiohttp import ClientSession
|
2023-09-03 08:26:26 +00:00
|
|
|
|
2023-10-04 05:20:51 +00:00
|
|
|
from ..base_provider import AsyncProvider
|
2023-09-03 08:26:26 +00:00
|
|
|
|
2023-07-28 10:07:17 +00:00
|
|
|
|
2023-09-05 15:27:24 +00:00
|
|
|
class Wewordle(AsyncProvider):
|
|
|
|
url = "https://wewordle.org"
|
2023-10-01 08:36:09 +00:00
|
|
|
working = False
|
2023-08-27 15:37:44 +00:00
|
|
|
supports_gpt_35_turbo = True
|
2023-07-28 10:07:17 +00:00
|
|
|
|
2023-08-24 19:32:22 +00:00
|
|
|
@classmethod
|
2023-09-05 15:27:24 +00:00
|
|
|
async def create_async(
|
2023-08-24 19:32:22 +00:00
|
|
|
cls,
|
2023-07-28 10:07:17 +00:00
|
|
|
model: str,
|
|
|
|
messages: list[dict[str, str]],
|
2023-09-05 15:27:24 +00:00
|
|
|
proxy: str = None,
|
|
|
|
**kwargs
|
|
|
|
) -> str:
|
2023-08-27 15:37:44 +00:00
|
|
|
|
2023-07-28 10:07:17 +00:00
|
|
|
headers = {
|
2023-08-27 15:37:44 +00:00
|
|
|
"accept" : "*/*",
|
|
|
|
"pragma" : "no-cache",
|
|
|
|
"Content-Type" : "application/json",
|
|
|
|
"Connection" : "keep-alive"
|
2023-07-28 10:07:17 +00:00
|
|
|
}
|
2023-09-05 15:27:24 +00: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 15:37:44 +00:00
|
|
|
"user" : _user_id,
|
|
|
|
"messages" : messages,
|
2023-07-28 10:07:17 +00:00
|
|
|
"subscriber": {
|
2023-08-27 15:37:44 +00: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 10:07:17 +00:00
|
|
|
"allPurchasedProductIdentifiers": [],
|
2023-08-27 15:37:44 +00:00
|
|
|
"firstSeen" : _request_date,
|
|
|
|
"activeSubscriptions" : [],
|
|
|
|
}
|
2023-07-28 10:07:17 +00:00
|
|
|
}
|
|
|
|
|
2023-09-05 15:27:24 +00: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
|