voletro / TikTokToYT

Downloads a trending TikTok video and uploads it to YouTube.
71 stars 16 forks source link

make it deployable on heroku & delete local video after upload to yt done #2

Open javazsaz opened 2 years ago

javazsaz commented 2 years ago

hi voletro, at the first special thanks for your special work , please if it's possible make it deployable on heroku , all buildpacks needed like selenium are available & using set worker on procfile can run important command after heroku dyno awake daily & using http://kaffeine.herokuapp.com/ to ping every 30 minutes so it will never go to sleep :) waiting for your commits for changes ;) finest regards

javazsaz commented 2 years ago

hello again , after deployed to heroku using setting below get error :

████████╗██╗██╗ ██╗████████╗ ██████╗ ██╗ ██╗ ████████╗ ██████╗ ██╗ ██╗████████╗ ╚══██╔══╝██║██║ ██╔╝╚══██╔══╝██╔═══██╗██║ ██╔╝ ╚══██╔══╝██╔═══██╗ ╚██╗ ██╔╝╚══██╔══╝ ██║ ██║█████╔╝ ██║ ██║ ██║█████╔╝ ██║ ██║ ██║ ╚████╔╝ ██║
██║ ██║██╔═██╗ ██║ ██║ ██║██╔═██╗ ██║ ██║ ██║ ╚██╔╝ ██║
██║ ██║██║ ██╗ ██║ ╚██████╔╝██║ ██╗ ██║ ╚██████╔╝ ██║ ██║
╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝

Traceback (most recent call last): File "/app/main.py", line 259, in main() File "/app/main.py", line 196, in main api = TikTokApi.get_instance() File "/app/.heroku/python/lib/python3.9/site-packages/TikTokApi/tiktok.py", line 149, in get_instance TikTokApi(kwargs) File "/app/.heroku/python/lib/python3.9/site-packages/TikTokApi/tiktok.py", line 59, in init self.browser = browser(kwargs) File "/app/.heroku/python/lib/python3.9/site-packages/TikTokApi/browser.py", line 82, in init raise e File "/app/.heroku/python/lib/python3.9/site-packages/TikTokApi/browser.py", line 78, in init self.browser = get_playwright().webkit.launch( File "/app/.heroku/python/lib/python3.9/site-packages/playwright/sync_api/_generated.py", line 10094, in launch self._sync( File "/app/.heroku/python/lib/python3.9/site-packages/playwright/_impl/_sync_base.py", line 111, in _sync return task.result() File "/app/.heroku/python/lib/python3.9/site-packages/playwright/_impl/_browser_type.py", line 90, in launch raise e File "/app/.heroku/python/lib/python3.9/site-packages/playwright/_impl/_browser_type.py", line 86, in launch return from_channel(await self._channel.send("launch", params)) File "/app/.heroku/python/lib/python3.9/site-packages/playwright/_impl/_connection.py", line 36, in send return await self.inner_send(method, params, False) File "/app/.heroku/python/lib/python3.9/site-packages/playwright/_impl/_connection.py", line 54, in inner_send result = next(iter(done)).result() playwright._impl._api_types.Error: ENOENT: no such file or directory, mkdtemp '/app/tmp/playwright-artifacts-N599ai'


my dyno setting is :

Config Vars: PATH="/usr/local/bin:/usr/bin:/bin:/app/vendor/" LD_LIBRARY_PATH="/usr/local/lib:/usr/lib:/lib:/app/vendor" PLAYWRIGHT_BUILDPACK_BROWSERS="firefox" TMPDIR="/app/tmp"

buildpacks: heroku/python http://github.com/yegor256/firefox-buildpack http://github.com/buitron/geckodriver-buildpack https://github.com/mxschmitt/heroku-playwright-buildpack https://github.com/jonathanong/heroku-buildpack-ffmpeg-latest


important : Firefox

For Firefox, you can refer to the official examples, no need to adjust any configurations.

const { firefox } = require("playwright-firefox");

(async () => { const browser = await chromium.launch(); const context = await browser.newContext(); const page = await context.newPage(); await page.goto('http://whatsmyuseragent.org/'); await page.screenshot({ path: firefox.png }); await browser.close(); })(); refrence : https://github.com/playwright-community/heroku-playwright-buildpack#firefox


I think you must be little change on your code to compatable waiting for your response finest regards

voletro commented 2 years ago

Hi javazsaz, That's perfectly fine, I will start working on making it deployable on heroku now. I will also quickly add support for removing the file after it is done uploading. Thanks!

ShlomoCode commented 2 years ago

@voletro Is there anything new about it? Deployment using Harko would be a great thing !