Code Monkey home page Code Monkey logo

youtube_uploader_selenium's People

Contributors

7x11x13 avatar alafalaki avatar korewalidesu avatar linouk23 avatar nishantsethi avatar philnagel avatar pop123123123 avatar romka777 avatar sakimotor avatar spacenerden avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

youtube_uploader_selenium's Issues

'NoneType' object has no attribute 'click'

Crash occurs on line 77, which says title_field.click() which comes after title_field = self.browser.find(By.ID, Constant.TEXTBOX).

Firefox opens and logs in correctly, but crashes very shortly after. Here is the full error:

'NoneType' object has no attribute 'click'
Traceback (most recent call last):
  File "/home/lostrobot/Automation Stuff/Uploader/YoutubeUploader.py", line 125, in <module>
    was_video_uploaded, video_id = uploader.upload()
  File "/home/lostrobot/.local/lib/python3.8/site-packages/youtube_uploader_selenium/__init__.py", line 47, in upload
    return self.__upload()
  File "/home/lostrobot/.local/lib/python3.8/site-packages/youtube_uploader_selenium/__init__.py", line 77, in __upload
    title_field.click()
AttributeError: 'NoneType' object has no attribute 'click'

I am using Ubuntu 20.04.
Thanks for the help in advance. I only have a few days to get this working, so I would be eternally grateful for a quick reply.

Upload as a draft

I want to be able to just upload the video to youtube as a DRAFT, so that It's no longer in my local computer but is in youtube servers, and be able to edit, add, thumbnail, captions etc later. Is it possible?

This browser or app may not be secure.

hi, developer. I try to use this python code, but when I login youtube, it notice me that "browser is not secure", how can I do?
my firefox version is 89.0 and had installed and configure the geckodriver
image

Upload button not clickable

Hi,

This was working fine before but now gives the following error:

image

I'm trying to upload a private video on youtube and through a XRDP session on Ubuntu 18.04 LTS.


Do let me know if you require more details.

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte

Traceback (most recent call last):
File "C:\Users\felip\OneDrive\Documentos\bots\youtubebot\test.py", line 22, in
finalVideoId = youtubeUplaodVideoSelenium(videoFile, videoThumb, videoThumb)
File "C:\Users\felip\OneDrive\Documentos\bots\youtubebot\youtube.py", line 336, in youtubeUplaodVideoSelenium
uploader = YouTubeUploader(file, metadata, thumbnail)
File "C:\Users\felip\OneDrive\Documentos\bots\youtubebot\youtube_uploader_init_.py", line 31, in init
self.metadata_dict = load_metadata(metadata_json_path)
File "C:\Users\felip\OneDrive\Documentos\bots\youtubebot\youtube_uploader_init_.py", line 21, in load_metadata
return defaultdict(str, json.load(metadata_json_file))
File "C:\Users\felip\AppData\Local\Programs\Python\Python310\lib\json_init_.py", line 293, in load
return loads(fp.read(),
File "C:\Users\felip\AppData\Local\Programs\Python\Python310\lib\codecs.py", line 322, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte
PS C:\Users\felip\OneDrive\Documentos\bots\youtubebot>

Can the credentials file be copied to othermachines?

I'd like to use this on a few raspberry pis. But I don't want to graphically launch firefox on each to generate a credentials file. Can I do it on just one and then copy this credentials to other machines?

The reason I do not want to launch firefox on each one is because I am running all these machines headless . They are on a local network and not directly accessible . I have to login to a "jump server" to get to them. It's possible , but a bit of a pain to have to tunnel VNC graphics through them and the jump server..

Youtube upload stops

My problem is that after script finishes, it closes firefox and upload stops. Also Thumbnail and Tags are missing, kinda big deal with automation

UnicodeDecodeError: 'gbk' codec can't decode byte 0x80 in position 23: illegal multibyte sequence

Traceback (most recent call last):
File "E:/audio_book/upload.py", line 6, in
uploader = YouTubeUploader(video_path,metadata_path)
File "C:\Users\a\AppData\Local\Programs\Python\Python38\lib\site-packages\youtube_uploader_selenium_init_.py", line 29, in init
self.metadata_dict = load_metadata(metadata_json_path)
File "C:\Users\a\AppData\Local\Programs\Python\Python38\lib\site-packages\youtube_uploader_selenium_init_.py", line 20, in load_metadata
return defaultdict(str, json.load(metadata_json_file))
File "C:\Users\a\AppData\Local\Programs\Python\Python38\lib\json_init_.py", line 293, in load
return loads(fp.read(),
UnicodeDecodeError: 'gbk' codec can't decode byte 0x80 in position 23: illegal multibyte sequence

WebDriver.__init__() got an unexpected keyword argument 'firefox_options'

I'm with this error

File "C:\Users\felip\OneDrive\Documentos\bots\youtubebot\youtube_uploader_init_.py", line 33, in init
self.browser = Firefox(current_working_dir, current_working_dir)
File "C:\Users\felip\OneDrive\Documentos\bots\youtubebot\venv\lib\site-packages\selenium_firefox\firefox.py", line 86, in init
self.driver = webdriver.Firefox(firefox_profile=profile, firefox_options=options)
TypeError: WebDriver.init() got an unexpected keyword argument 'firefox_options'

The program reports an error

It should be the part that uploads thumbnails

Message: Element

is not clickable at point (478,291) because another element
obscures it

My description as set as title

all works fines,
login, upload, thumbnail, title,
but few time after my title are set, my description overwrite it
anyone know how to fix this ?

ImportError: cannot import name 'By' from 'selenium_firefox.firefox'

$ python3 upload.py --video video.mp4
Traceback (most recent call last):
  File "upload.py", line 2, in <module>
    from youtube_uploader_selenium import YouTubeUploader
  File "/home/test/projetcs/youtube_uploader_selenium/youtube_uploader_selenium/__init__.py", line 5, in <module>
    from selenium_firefox.firefox import Firefox, By, Keys
ImportError: cannot import name 'By' from 'selenium_firefox.firefox' (/home/test/.local/lib/python3.7/site-packages/selenium_firefox/firefox.py)

Does script work wuthout GUI?

As I understood the script uses firefox, but firefox does not work without Linux GUI.
I get

Traceback (most recent call last):
  File "upload.py", line 19, in <module>
    main(args.video, args.meta)
  File "upload.py", line 7, in main
    uploader = YouTubeUploader(video_path, metadata_path)
  File "/home/azat/youtube_uploader_selenium/youtube_uploader_selenium/__init__.py", line 31, in __init__
    self.browser = Firefox(current_working_dir, current_working_dir)
  File "/usr/local/lib/python3.7/dist-packages/selenium_firefox/firefox.py", line 178, in __init__
    firefox_binary=ff_binary
  File "/usr/local/lib/python3.7/dist-packages/selenium/webdriver/firefox/webdriver.py", line 174, in __init__
    keep_alive=True)
  File "/usr/local/lib/python3.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 157, in __init__
    self.start_session(capabilities, browser_profile)
  File "/usr/local/lib/python3.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "/usr/local/lib/python3.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "/usr/local/lib/python3.7/dist-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: Process unexpectedly closed with status 1

Error - Firefox: quit() -  'Firefox' object has no attribute 'driver'

Crashing in the youtube "Checks" section of the upload

DEBUG:youtube_uploader_selenium:Attached video test.mp4
DEBUG:youtube_uploader_selenium:The video title was set to "Best Of James Harden | 2019-20 NBA Season"
DEBUG:youtube_uploader_selenium:The video description was set to "Check out the best of James Harden's 2019-20 season so far!"
DEBUG:youtube_uploader_selenium:Selected "NOT_MADE_FOR_KIDS"
DEBUG:youtube_uploader_selenium:Clicked next-button
DEBUG:youtube_uploader_selenium:Clicked another next-button
'NoneType' object has no attribute 'click'
Traceback (most recent call last):
File "E:/dev/uploady/eradinus.py", line 11, in
was_video_uploaded, video_id = uploader.upload()
File "E:\dev\Anaconda\lib\site-packages\youtube_uploader_selenium_init_.py", line 47, in upload
return self._upload()
File "E:\dev\Anaconda\lib\site-packages\youtube_uploader_selenium_init
.py", line 110, in __upload
self.browser.find(By.ID, Constant.RADIO_LABEL, public_main_button).click()
AttributeError: 'NoneType' object has no attribute 'click'

Process finished with exit code 1

The next button in the checks column is blue and can be clicked but the program waits for 10 seconds and crashes here.

__init__.py THROWS 2 ERRORS FOR ME

COULD NOT RESOLVE THEM

Tuple expression not allowed in type annotation
  Use Tuple[T1, ..., Tn] to indicate a tuple type or Union[T1, T2] to indicate a union type

Here is screenshot
image

Second error:

ImportError: cannot import name 'By' from 'selenium_firefox.firefox' (C:\Users\d\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium_firefox\firefox.py)

Here are screenshots
image

image

Title not setting correctly

My title is set to the title in my metadata.json and the default title youtube gives, is there a way to fix that ?

Some issues + possible fixes...

Hello,

First of all, thanks for this amazing code. I just want to mention a few issues I saw while working with this package. I am using Windows, so some of the issues might be because of it. (I believe the code is implemented for MAC)

  1. The code is a bit old, so if you encounter the error "This browser or app may not be secure" in the first login process, just try an older version of FireFox (I made it work with version 77).

  2. It misses a third click on the next button in the uploading process. Otherwise it will stuck at Checks dialogue and does not complete the uploading process. Just add another click on the next button in init.py file line 139:

self.browser.find(By.ID, Constant.NEXT_BUTTON).click()
self.logger.debug('Clicked another another {}'.format(Constant.NEXT_BUTTON))

(There is already a commit that fixes this issue + updates in the constant variables)

  1. @linouk23 recently fixed an issue in filling the description field process, but I believe they forgot to add a __write_in_the_field in the process. In my tests, the description was not filled without it. (Also, I added a line of code to replace \n character with the button Enter to make a new line in description) the same init.py file line 106:
video_description = self.metadata_dict[Constant.VIDEO_DESCRIPTION]
video_description = video_description.replace("\n", Keys.ENTER);
if video_description:
	description_field = self.browser.find_all(By.ID, Constant.TEXTBOX)[1]
	self.__write_in_field(description_field, video_description, select_all=True)
	self.logger.debug('Set the description.')
  1. This one is only an issue for the Windows users. The __write_in_the_field function has an select_all feature to delete the existing inputs in the field, but it only works on MAC. Because it uses "command+a" instead of "control+a". It could be a feature maybe? (same file, line 77)
field.send_keys(Keys.CONTROL + 'a')
  1. Also, here is a sample of the json file if you want to add tags and do not want to go through the code on how to do it : )
{
    "title": "Test Title",
    "description": "Test Description.",
    "tags": ["test1", "test2", "test3"]
}

I believe these are the changes I made to make this work for me. Again, Thanks a lot to @linouk23 for making the code public.

can't login via firefox 77

Couldn’t sign you in
This browser or app may not be secure. Learn more
Try using a different browser. If you’re already using a supported browser, you can try again to sign in.

AWS Lightsail

I want to use the package in AWS Lightsail, but I am using ubuntu which I believe doesn't provide RDP or something like that except for a terminal, Is there a way for me to not authenticate in a browser ( for a brand account ) ?

Cant upload videos

it closes the window before uploading anything and I get this message
Message: Element is not clickable at point (1124,207) because another element obscures it

__init__() got an unexpected keyword argument 'firefox_options'

Traceback (most recent call last):
File "F:\test\222\youtube_uploader_selenium-master\uup.py", line 7, in
uploader = YouTubeUploader(video_path, metadata_path, thumbnail_path)
File "F:\test\222\youtube_uploader_selenium-master\youtube_uploader_selenium_init_.py", line 33, in init
self.browser = Firefox(current_working_dir, current_working_dir)
File "F:\test\222\youtube_uploader_selenium-master\venv\lib\site-packages\selenium_firefox\firefox.py", line 86, in init
self.driver = webdriver.Firefox(firefox_profile=profile, firefox_options=options)
TypeError: init() got an unexpected keyword argument 'firefox_options'

How to solve this problem ?

Add option to specify thumbnail

With official Youtube API, we have an option to specify a custom thumbnail for the video. Such functionality can be included here as well.

ImportError: cannot import name 'By' from 'selenium_firefox.firefox'

Traceback (most recent call last):
File "upload.py", line 1, in
from youtube_uploader_selenium import YouTubeUploader
File "/home/ubuntu/.local/lib/python3.8/site-packages/youtube_uploader_selenium/init.py", line 5, in
from selenium_firefox.firefox import Firefox, By, Keys
ImportError: cannot import name 'By' from 'selenium_firefox.firefox' (/home/ubuntu/.local/lib/python3.8/site-packages/selenium_firefox/firefox.py)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.