diff options
| author | A Farzat <a@farzat.xyz> | 2025-08-24 16:49:25 +0300 |
|---|---|---|
| committer | A Farzat <a@farzat.xyz> | 2025-08-24 16:49:25 +0300 |
| commit | fafe6fcb0e6b2b597b13799bf1324c90d72a2873 (patch) | |
| tree | 2723a1e66398f8fc8dd9a2d8c0de5fa6073883a2 /wsgi | |
| parent | 9bb6514c2bd9fb8048c1c3d045a96eed484424f2 (diff) | |
| download | csca5028-fafe6fcb0e6b2b597b13799bf1324c90d72a2873.tar.gz csca5028-fafe6fcb0e6b2b597b13799bf1324c90d72a2873.zip | |
Create a flask application
Diffstat (limited to 'wsgi')
| -rw-r--r-- | wsgi/__init__.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/wsgi/__init__.py b/wsgi/__init__.py new file mode 100644 index 0000000..d3343b0 --- /dev/null +++ b/wsgi/__init__.py @@ -0,0 +1,15 @@ +from typing import Any, Dict, List +from components.database import subscriptions +from components.subscriptions.main import Subscription +from components.videos import VideoTuple +from flask import Flask +from flask_cors import CORS + +app = Flask(__name__) +CORS(app) + +@app.route("/vid-from-link/<id>") +def videos_from_link(id: str) -> List[Dict[str, Any]]: + sub = subscriptions.find_one({"_id": id}) + assert sub + return [VideoTuple._make(vid)._asdict() for vid in sub["videos"]] |
