ContentAutomation/YouTubeUploader

Selenium Error

NecroBoy opened this issue · 7 comments

When trying upload by Docker:

python3.8 main.py -B docker -l test.json -t testik -d test /uploads/videoname.mp4
INFO:root:Current progress: Upload complete ... Processing will begin shortly
INFO:root:Current progress: Processing 95% ...
INFO:root:Current progress: Processing 100% ...
Traceback (most recent call last):
File "main.py", line 137, in
main()
File "main.py", line 47, in main
upload_file(
File "/root/YouTubeUploader/src/upload.py", line 41, in upload_file
_set_endcard(driver)
File "/root/YouTubeUploader/src/upload.py", line 128, in _set_endcard
driver.find_element_by_css_selector("div.card:nth-child(1)").click()
File "/usr/local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 598, in find_element_by_css_selector
return self.find_element(by=By.CSS_SELECTOR, value=css_selector)
File "/usr/local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 976, in find_element
return self.execute(Command.FIND_ELEMENT, {
File "/usr/local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "/usr/local/lib/python3.8/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.NoSuchElementException: Message: Unable to locate element: div.card:nth-child(1)

Video uploaded, but Visibility is draft

This problem is probably because YouTube regularly changes their id and classnames when they release new stuff on the youtube uploader. If you are a bit into WebDev you can try to debug it by using chromedriver/geckodriver and your local chrome/firefox browser to run our tool with chrome/firefox you can just add the -B 'docker' or -B 'chrome' argument.
Then you can just debug the code as usual.

If you can not resolve it @ChristianCoenen will look into this during the next week and we will maybe provide a more detailed guide on how to debug those kind of issues.

I fixed it, program crashes because it tries to add a cardboard at the end of video.

@NecroBoy what's the resolution to the cardboard at the end? Would love to see a code patch or just your comment here? I'm also running into it regularly! It craps out and leaves the upload at the draft stage.

@NecroBoy what's the resolution to the cardboard at the end? Would love to see a code patch or just your comment here? I'm also running into it regularly! It craps out and leaves the upload at the draft stage.

Hello sir! You need just comment section when program tries to add cardboards.
Have a nice day!

I can’t send fixed code because my server died (SSD died). If you can’t fix this cardboard issue just write me. I’ll help you.

@NecroBoy OMG that would be very helpful! Yes, the cardboard issue keeps happening every few runs. How did you debug it?? I am not even sure how to get chromedriver to stop the run!

@nitinthewiz As far as I remember the endcard setup is optional. Can you try commenting out the _set_endcard call here?

If you need the endcard settings and want to fix it you can check the _set_endcard method, specifically this line:

driver.find_element_by_css_selector("div.card:nth-child(1)").click()

Likely the CSS just changed on the endcard page.