mirror of
https://github.com/lanqian528/chat2api.git
synced 2026-06-13 21:02:46 +08:00
update pow
This commit is contained in:
parent
b46538e14c
commit
2dc1cb5371
2
.github/workflows/build_docker.yml
vendored
2
.github/workflows/build_docker.yml
vendored
@ -37,7 +37,7 @@ jobs:
|
||||
images: lanqian528/chat2api
|
||||
tags: |
|
||||
type=raw,value=latest,enable={{is_default_branch}}
|
||||
type=raw,value=v1.4.10
|
||||
type=raw,value=v1.4.11
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v5
|
||||
|
||||
@ -388,7 +388,6 @@ class ScriptSrcParser(HTMLParser):
|
||||
if "src" in attrs_dict:
|
||||
src = attrs_dict["src"]
|
||||
cached_scripts.append(src)
|
||||
print(cached_scripts)
|
||||
match = re.search(r"c/[^/]*/_", src)
|
||||
if match:
|
||||
cached_dpl = match.group(0)
|
||||
@ -396,19 +395,18 @@ class ScriptSrcParser(HTMLParser):
|
||||
|
||||
|
||||
def get_data_build_from_html(html_content):
|
||||
global cached_scripts, cached_dpl, cached_time
|
||||
parser = ScriptSrcParser()
|
||||
parser.feed(html_content)
|
||||
get_data_build_from_document_element(html_content)
|
||||
return cached_dpl
|
||||
|
||||
|
||||
def get_data_build_from_document_element(html_content):
|
||||
global cached_dpl, cached_time
|
||||
match = re.search(r'<html[^>]*data-build="([^"]*)"', html_content)
|
||||
if match:
|
||||
data_build = match.group(1)
|
||||
cached_time = int(time.time())
|
||||
logger.info(f"Found dpl: {data_build}")
|
||||
if not cached_scripts:
|
||||
cached_scripts.append("https://chatgpt.com/backend-api/sentinel/sdk.js")
|
||||
if not cached_dpl:
|
||||
match = re.search(r'<html[^>]*data-build="([^"]*)"', html_content)
|
||||
if match:
|
||||
data_build = match.group(1)
|
||||
cached_dpl = data_build
|
||||
cached_time = int(time.time())
|
||||
logger.info(f"Found dpl: {cached_dpl}")
|
||||
|
||||
|
||||
async def get_dpl(service):
|
||||
@ -428,8 +426,9 @@ async def get_dpl(service):
|
||||
raise Exception("No Cached DPL")
|
||||
else:
|
||||
return True
|
||||
except Exception:
|
||||
cached_dpl = "remix-prod-14f2d9d20b1dff8b7a6ecf23d472dbc30191dfaa"
|
||||
except Exception as e:
|
||||
logger.info(f"Failed to get dpl: {e}")
|
||||
cached_dpl = None
|
||||
cached_time = int(time.time())
|
||||
return False
|
||||
|
||||
|
||||
@ -49,7 +49,7 @@ proxy_url_list = proxy_url.split(',') if proxy_url else []
|
||||
user_agents_list = ast.literal_eval(user_agents)
|
||||
|
||||
logger.info("-" * 60)
|
||||
logger.info("Chat2Api 1.4.10 | https://github.com/lanqian528/chat2api")
|
||||
logger.info("Chat2Api 1.4.11 | https://github.com/lanqian528/chat2api")
|
||||
logger.info("-" * 60)
|
||||
logger.info("Environment variables:")
|
||||
logger.info("API_PREFIX: " + str(api_prefix))
|
||||
|
||||
Loading…
Reference in New Issue
Block a user