Update app.py
Browse files
app.py
CHANGED
|
@@ -1,40 +1,11 @@
|
|
| 1 |
-
|
| 2 |
-
from playwright.sync_api import sync_playwright
|
| 3 |
|
| 4 |
-
|
|
|
|
| 5 |
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
# Navigate to ChatGPT page
|
| 14 |
-
page.goto("https://chatgpt.com")
|
| 15 |
-
|
| 16 |
-
# Wait for the chat input area to load
|
| 17 |
-
page.wait_for_selector('textarea[placeholder="Type a message…"]')
|
| 18 |
-
|
| 19 |
-
# Type a message into the chat input
|
| 20 |
-
page.fill('textarea[placeholder="Type a message…"]', query)
|
| 21 |
-
|
| 22 |
-
# Press Enter to send the message
|
| 23 |
-
page.press('textarea[placeholder="Type a message…"]', 'Enter')
|
| 24 |
-
|
| 25 |
-
# Wait for the response (adjust the wait time as necessary)
|
| 26 |
-
page.wait_for_selector('div[class*="message-response-class"]') # Adjust the class name
|
| 27 |
-
|
| 28 |
-
# Extract the response text
|
| 29 |
-
response = page.query_selector('div[class*="message-response-class"]') # Adjust the class name
|
| 30 |
-
message = response.inner_text() if response else "No response found."
|
| 31 |
-
|
| 32 |
-
# Close the browser
|
| 33 |
-
browser.close()
|
| 34 |
-
|
| 35 |
-
return {"response": message}
|
| 36 |
-
|
| 37 |
-
if __name__ == "__main__":
|
| 38 |
-
import uvicorn
|
| 39 |
-
port = int(os.environ.get("PORT", 7860)) # HF Spaces sets this automatically
|
| 40 |
-
uvicorn.run(app, host="0.0.0.0", port=port)
|
|
|
|
| 1 |
+
import subprocess
|
|
|
|
| 2 |
|
| 3 |
+
url = "https://hlsx3cdn.echovideo.to/naruto/1/master.m3u8"
|
| 4 |
+
output = "/tmp/video.mp4" # HF Spaces usually allow writing in /tmp
|
| 5 |
|
| 6 |
+
subprocess.run([
|
| 7 |
+
"ffmpeg",
|
| 8 |
+
"-i", url,
|
| 9 |
+
"-c", "copy",
|
| 10 |
+
output
|
| 11 |
+
])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|