tropicoo / yt-dlp-bot

Self-hosted Video Download Telegram Bot 🇺🇦
BSD 3-Clause "New" or "Revised" License
212 stars 71 forks source link

how to run only api without bot #252

Closed armm29393 closed 7 months ago

armm29393 commented 7 months ago

I just want to use yt-dlp api without telegram bot how to run service without telegram env config

tropicoo commented 7 months ago

Comment out this block https://github.com/tropicoo/yt-dlp-bot/blob/26c464c14d55541e571e5f12860a4a46743fcb3e/docker-compose.yml#L28-L45

armm29393 commented 7 months ago

I try and got error when create task

Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/starlette/middleware/errors.py", line 164, in call await self.app(scope, receive, _send) File "/usr/local/lib/python3.11/site-packages/starlette/middleware/gzip.py", line 24, in call await responder(scope, receive, send) File "/usr/local/lib/python3.11/site-packages/starlette/middleware/gzip.py", line 44, in call await self.app(scope, receive, self.send_with_gzip) File "/usr/local/lib/python3.11/site-packages/starlette/middleware/exceptions.py", line 62, in call await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send) File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app raise exc File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app await app(scope, receive, sender) File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 758, in call await self.middleware_stack(scope, receive, send) File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 778, in app await route.handle(scope, receive, send) File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 299, in handle await self.app(scope, receive, send) File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 79, in app await wrap_app_handling_exceptions(app, request)(scope, receive, send) File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app raise exc File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app await app(scope, receive, sender) File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 74, in app response = await func(request) ^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/fastapi/routing.py", line 299, in app raise e File "/usr/local/lib/python3.11/site-packages/fastapi/routing.py", line 294, in app raw_response = await run_endpoint_function( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/fastapi/routing.py", line 191, in run_endpoint_function return await dependant.call(**values) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/api/api_v1/endpoints/tasks.py", line 45, in create_task return await TaskService.create_task_non_db(task=task, publisher=pb) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/core/services/task.py", line 69, in create_task_non_db payload = InbMediaPayload( ^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/pydantic/main.py", line 171, in init self.__pydantic_validator__.validate_python(data, self_instance=self) pydantic_core._pydantic_core.ValidationError: 5 validation errors for InbMediaPayload from_chat_id Field required [type=missing, input_value={'id': UUID('f0b1b133-8f2...'save_to_storage': True}, input_type=dict] For further information visit https://errors.pydantic.dev/2.6/v/missing from_chat_type Field required [type=missing, input_value={'id': UUID('f0b1b133-8f2...'save_to_storage': True}, input_type=dict] For further information visit https://errors.pydantic.dev/2.6/v/missing from_user_id Field required [type=missing, input_value={'id': UUID('f0b1b133-8f2...'save_to_storage': True}, input_type=dict] For further information visit https://errors.pydantic.dev/2.6/v/missing message_id Field required [type=missing, input_value={'id': UUID('f0b1b133-8f2...'save_to_storage': True}, input_type=dict] For further information visit https://errors.pydantic.dev/2.6/v/missing ack_message_id Field required [type=missing, input_value={'id': UUID('f0b1b133-8f2...'save_to_storage': True}, input_type=dict] For further information visit https://errors.pydantic.dev/2.6/v/missing

armm29393 commented 7 months ago

I added default value none in class InbMediaPayload it's worked

class InbMediaPayload(RealBaseModel):
     """RabbitMQ inbound media payload from Telegram Bot or API service."""

     id: uuid.UUID | None = None
-    from_chat_id: StrictInt | None
-    from_chat_type: TelegramChatType | None
-    from_user_id: StrictInt | None
-    message_id: StrictInt | None
-    ack_message_id: StrictInt | None
+    from_chat_id: StrictInt | None = None
+    from_chat_type: TelegramChatType | None = None
+    from_user_id: StrictInt | None = None
+    message_id: StrictInt | None = None
+    ack_message_id: StrictInt | None = None
     url: StrictStr
     original_url: StrictStr
     source: TaskSource

and I found bug when call delete task task has deleted but yt_worker still downloading test url : https://www.youtube.com/watch?v=jfKfPfyJRdk

tropicoo commented 7 months ago

Should be fixed now