Linus404 / TwiTok

🎞📲 Download the most viewed Twitch clips and receive them via telegram with various options available.
https://github.com/Linus404/TwiTok
1 stars 1 forks source link

render.com incompability #1

Closed bugbounted closed 5 months ago

bugbounted commented 5 months ago

hi Linus404, im trying to deploy this code in render.com but getting error below :

==> Running 'python main.py'
2024-06-01 11:06:04,500 - __main__ - ERROR - Unhandled exception: [Errno 2] No such file or directory: '/opt/render/project/src/Videos'
Traceback (most recent call last):
  File "/opt/render/project/src/main.py", line 317, in <module>
    premain()
  File "/opt/render/project/src/main.py", line 298, in premain
    clean_up()
  File "/opt/render/project/src/main.py", line 38, in clean_up
    for game_folder in os.listdir(videos_dir): # Iterate over all game folders
                       ^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/opt/render/project/src/Videos'

please fix it or make new branch for cloud stack deployable regards

Linus404 commented 5 months ago

Thank you for reaching out to me. I have added a function which creates the Videos directory if it doesn't exist. That should fix the issue. Please try again and tell me if it worked so I can close this issue.

bugbounted commented 5 months ago

hello again bro , after deploy your latest commit to render.com as web service get error below :

==> Running 'python main.py'
2024-06-01 16:29:01,147 - __main__ - INFO - Created directory: /opt/render/project/src/Videos
2024-06-01 16:29:01,147 - __main__ - INFO - Video folder cleanup completed.
2024-06-01 16:29:01,386 - telegram.ext.Application - INFO - Application started
==> No open ports detected, continuing to scan...
==> Docs on specifying a port: https://render.com/docs/web-services#port-binding
==> No open ports detected, continuing to scan...
==> Docs on specifying a port: https://render.com/docs/web-services#port-binding
==> Detected new open ports UDP:34669, UDP:39148, UDP:56637
2024-06-01 16:31:41,643 - telegram.ext.Application - ERROR - No error handlers are registered, logging exception.
Traceback (most recent call last):
  File "/opt/render/project/src/.venv/lib/python3.11/site-packages/telegram/ext/_application.py", line 1325, in process_update
    await coroutine
  File "/opt/render/project/src/.venv/lib/python3.11/site-packages/telegram/ext/_handlers/basehandler.py", line 157, in handle_update
    return await self.callback(update, context)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/render/project/src/main.py", line 235, in timewindow_chosen
    await subtitles_chosen(update, context)
  File "/opt/render/project/src/main.py", line 263, in subtitles_chosen
    await task
  File "/opt/render/project/src/main.py", line 293, in run_main
    main(game, num_clips, timewindow, subtitles)
  File "/opt/render/project/src/main.py", line 302, in main
    clip_list = get_clip_data(num_clips, url)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/render/project/src/twitch_scraper.py", line 30, in get_clip_data
    html_content = driver.page_source # Get the page source after JavaScript rendering
                   ^^^^^^^^^^^^^^^^^^
  File "/opt/render/project/src/.venv/lib/python3.11/site-packages/selenium/webdriver/remote/webdriver.py", line 448, in page_source
    return self.execute(Command.GET_PAGE_SOURCE)["value"]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/render/project/src/.venv/lib/python3.11/site-packages/selenium/webdriver/remote/webdriver.py", line 347, in execute
    self.error_handler.check_response(response)
  File "/opt/render/project/src/.venv/lib/python3.11/site-packages/selenium/webdriver/remote/errorhandler.py", line 229, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: session deleted because of page crash
from unknown error: cannot determine loading status
from tab crashed
  (Session info: chrome=125.0.6422.141)
Stacktrace:
#0 0x55b342fa4e3a <unknown>
#1 0x55b342c8e2a1 <unknown>
#2 0x55b342c765c7 <unknown>
#3 0x55b342c75e1b <unknown>
#4 0x55b342c75503 <unknown>
#5 0x55b342c753f5 <unknown>
#6 0x55b342c73336 <unknown>
#7 0x55b342c739af <unknown>
#8 0x55b342c84287 <unknown>
#9 0x55b342c9a55e <unknown>
#10 0x55b342c9fc5b <unknown>
#11 0x55b342c740fa <unknown>
#12 0x55b342c9a14f <unknown>
#13 0x55b342d1c195 <unknown>
#14 0x55b342cfd253 <unknown>
#15 0x55b342ccd1c7 <unknown>
#16 0x55b342ccdb3e <unknown>
#17 0x55b342f6b27b <unknown>
#18 0x55b342f6f327 <unknown>
#19 0x55b342f57dae <unknown>
#20 0x55b342f6fdf2 <unknown>
#21 0x55b342f3c74f <unknown>
#22 0x55b342f94128 <unknown>
#23 0x55b342f942fb <unknown>
#24 0x55b342fa3f6c <unknown>
#25 0x7f2e025d7fa3 start_thread
Linus404 commented 5 months ago

I'm not experienced with cloud deployment, so I'm unsure if Selenium and other packages are compatible with render.com. You can try checking their compatibility documentation or forums. Additionally, I suggest adding extensive logging and exception handling to pinpoint where errors occur. You might also want to deactivate headless mode temporarily to observe where the process gets stuck. Unfortunately, I can't offer further assistance on this matter. Good luck! If you find a solution, feel free to create a pull request. In the meantime, I'll note that the code may not be cloud-compatible.

Linus404 commented 5 months ago

Thanks for opening another issue for this other problem. I will close this one since the first issue is resolved.