返回提交历史
Modified
g4f/Provider/needs_auth/Video.py
+10
-9
Modified
g4f/providers/base_provider.py
+1
-1
XFEstudio/gpt4free
Update video link
db1a9adb
代码差异
2 个文件
+11
-10
@@ -32,7 +32,7 @@ class Video(AsyncGeneratorProvider):
32
32
"https://sora.chatgpt.com/explore",
33
33
#"https://aistudio.google.com/generate-video"
34
34
]
35
pub_url = "http://bore.pub:40346"
35
pub_url = "https://home.g4f.dev"
36
36
api_url = f"{pub_url}/backend-api/v2/create"
37
37
search_url = f"{pub_url}/search/video+"
38
38
drive_url = "https://www.googleapis.com/drive/v3/"
@@ -79,7 +79,11 @@ class Video(AsyncGeneratorProvider):
79
79
raise MissingRequirementsError("Video provider requires a browser to be installed.")
80
80
RequestConfig.urls = []
81
81
try:
82
page = await browser.get(random.choice(cls.urls))
82
cls.page = await browser.get(random.choice(cls.urls))
83
except Exception as e:
84
debug.error(f"Error opening page:", e)
85
try:
86
page = cls.page
83
87
await asyncio.sleep(3)
84
88
await page.select("textarea", 240)
85
89
def on_request(event: nodriver.cdp.network.RequestWillBeSent, page=None):
@@ -130,7 +134,7 @@ class Video(AsyncGeneratorProvider):
130
134
except Exception as e:
131
135
debug.error(f"Error clicking 'Activity' button:", e)
132
136
try:
133
await asyncio.sleep(5)
137
await asyncio.sleep(15)
134
138
button = await page.find("Queued", timeout=30)
135
139
if button:
136
140
await button.click()
@@ -142,7 +146,7 @@ class Video(AsyncGeneratorProvider):
142
146
if RequestConfig.urls:
143
147
await asyncio.sleep(2)
144
148
RequestConfig.urls = list(set(RequestConfig.urls))
145
debug.log(f"Video URL: {RequestConfig.urls}")
149
debug.log(f"Video URL: {len(RequestConfig.urls)}")
146
150
yield VideoResponse(RequestConfig.urls, prompt, {
147
151
"headers": {"authorization": RequestConfig.headers.get("authorization")} if RequestConfig.headers.get("authorization") else {}
148
152
})
@@ -150,8 +154,5 @@ class Video(AsyncGeneratorProvider):
150
154
break
151
155
if idx == 599:
152
156
raise RuntimeError("Failed to get Video URL")
153
except Exception as e:
154
stop_browser()
155
raise e
156
await page.close()
157
stop_browser()
157
finally:
158
stop_browser()
@@ -22,7 +22,7 @@ from .helper import concat_chunks
22
22
from ..cookies import get_cookies_dir
23
23
from ..errors import ModelNotFoundError, ResponseError, MissingAuthError, NoValidHarFileError, PaymentRequiredError
24
24
25
DEFAULT_TIMEOUT = 180
25
DEFAULT_TIMEOUT = 600
26
26
27
27
SAFE_PARAMETERS = [
28
28
"model", "messages", "stream", "timeout",