Skip to main content

Upload videos to YouTube using geckodriver, Firefox profiles and Selenium.

Project description

UPDATED WITH NEW CONSTANTS

opplast

Version License Stars Issues Size Discord Code style

Donate Steam Donate PayPal

Upload videos to YouTube using geckodriver, Firefox profiles and Selenium. Easy to setup and use. Inspired by youtube_uploader_selenium.

"Opplast" is norwegian for "upload".

Installing

Install and update using pip:

pip install --upgrade opplast

geckodriver

Download geckodriver and place it inside C:\Users\USERNAME\AppData\Local\Programs\Python\Python37. If you are using another version of Python, you place it inside there. This only works if Python is added to PATH and it is the correct version.

You can check if geckodriver has been added to PATH by running geckodriver --version in the terminal. If this gives you an error or you are running into:

selenium.common.exceptions.WebDriverException: Message: 'geckodriver' executable needs to be in PATH.

Specify executable_path in the Configuration part.

Configuration

Open Firefox, and go to about:profiles. Click "Create a New profile" and name it "Selenium" or whatever. Copy the "Root Directory" path of the new profile. This is your root_profile_directory. Now you can "Launch profile in new browser", go to YouTube, and login to the account you want to upload with.

It's highly recommended that you clear your standard upload settings on YouTube.

Upload(root_profile_directory: str, executable_path: str = "geckodriver", timeout: int = 3, headless: bool = True, debug: bool = True, options: FirefoxOptions = webdriver.FirefoxOptions()) -> None

root_profile_directory: str - path to Firefox profile where you're logged into YouTube.

executable_path: str - full path to override which geckodriver binary to use for Firefox 47.0.1 and greater, which defaults to picking up the binary from the system path. Example: r"C:/Users/USERNAME/Desktop/geckodriver" (if geckodriver.exe is located in Desktop folder) Default: geckodriver.

timeout: int - seconds Selenium should wait, when getting pages and inserting data. Default: 3.

headless: bool - whether or not you want to see the browser GUI. Will override headless option if specified in options. Default: True (hidden).

debug: bool - whether or not you want to see the debug info. Default: True (shown).

options: FirefoxOptions - optional options for webdriver. Use headless if you want to hide browser.

Usage

from opplast import Upload


upload = Upload(
    # use r"" for paths, this will not give formatting errors e.g. "\n"
    r"C:/Users/USERNAME/AppData/Roaming/Mozilla/Firefox/Profiles/r4Nd0m.selenium",
)

was_uploaded, video_id = upload.upload(
    r"C:/path/to/video.mp4",
    title="My YouTube Title",
    description="My YouTube Description",
    thumbnail=r"C:/path/to/thumbnail.jpg",
    tags=["these", "are", "my", "tags"],
    only_upload=False # If True will not set title, description or anything else. 
    # Might be useful if you want to do it manually or by using the YouTube API.
)

if was_uploaded:
    print(f"{video_id} has been uploaded to YouTube")

upload.close()

License

MIT License

Copyright (c) 2021 offish

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

opplast-v2-2.0.1.tar.gz (7.3 kB view details)

Uploaded Source

Built Distribution

opplast_v2-2.0.1-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

Details for the file opplast-v2-2.0.1.tar.gz.

File metadata

  • Download URL: opplast-v2-2.0.1.tar.gz
  • Upload date:
  • Size: 7.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.5

File hashes

Hashes for opplast-v2-2.0.1.tar.gz
Algorithm Hash digest
SHA256 494b92925bce4480a4eee474a8f2df7ad4b3d84e88a172a3028bda9cf0a4ddbb
MD5 68ff3d5da3d64b2d4e5575a56b3ef51c
BLAKE2b-256 ec148a5a34ec86d066dfbae19229e4b78b7f70583c702c57191972bb64022edf

See more details on using hashes here.

File details

Details for the file opplast_v2-2.0.1-py3-none-any.whl.

File metadata

  • Download URL: opplast_v2-2.0.1-py3-none-any.whl
  • Upload date:
  • Size: 8.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.5

File hashes

Hashes for opplast_v2-2.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f39f426e100f14508a964330d08100677c2985b8b2759fb1333625b50c896437
MD5 b5e8054913e81b12655fcc628d4cfc91
BLAKE2b-256 23dd07635fb65c2ad03478e290a99a5f8346c210694c0205d6e6718cbf603c51

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page