summerpolew.blogg.se

Install selenium python ubuntu
Install selenium python ubuntu













install selenium python ubuntu

The cron job is defined in the file /etc/cron.d/my-cron. The RUN commands set up a cron job to run the Python script every hour. The COPY command copies the main.py file to the /app/ directory inside the container. Save the above code in a file named Dockerfile. RUN crontab /etc/cron.d/my-cron Start cron in the foreground RUN echo "0 * * * * /usr/bin/python3 /app/main.py" > /etc/cron.d/my-cron RUN pip3 install playwright selenium youtube-dl Copy the Python script to the containerĬOPY main.py /app/ Set up cron job to run the Python script every hour Here's a Dockerfile code that installs the necessary packages and sets up a cron job to run the main.py file every hour:Ĭopy code Use Ubuntu 18.04 as the base imageįROM ubuntu:18.04 Install Python 3 and pipĪpt-get install -y python3 python3-pip Install necessary Python packages Publish_button = browser.find_element_by_css_selector('button') Title_nd_keys('My uploaded video')ĭescription_input = browser.find_element_by_css_selector('textarea')ĭescription_nd_keys('This is my uploaded video') Title_input = browser.find_element_by_css_selector('input') Time.sleep(5) # Wait for the upload to complete Upload_nd_keys(os.path.abspath('final.mp4')) Upload_input = browser.find_element_by_css_selector('input') Video_link = page.query_selector('ytd-rich-item-renderer a') # Get the first video URL from the YouTube index page















Install selenium python ubuntu