wanghaisheng/tiktoka-studio-uploader

Changing the publishpolicy to 0 for "PRIVATE", not working.

Closed this issue · 1 comments

Hi,

I used your code to upload a basic video, works fine for me. But I wanted it to default upload to "PRIVATE" instead of "PUBLIC", so I searched around your code.
I found publishpolicy:str = 0 in the upload.py, I changed it to '0' and just 0 to make it default PRIVATE.

But I got an error.

Following was the debug log:

DEBUG: Firefox is now running
DEBUG: Trying to upload "**" to YouTube...
DEBUG: Found YouTube upload Dialog Modal
DEBUG: Trying to set "My YouTube Title - Testing ytb" as title...
DEBUG: Trying to set "My YouTube Description" as description...
DEBUG: Trying to set "
" as thumbnail...
DEBUG: Trying to set video to "Not made for kids"...
DEBUG: Trying to set "these,are,my,tags" as tags...
DEBUG: Trying to set video visibility to public...
Traceback (most recent call last):
File "e:\TwitchToYT-Test\Upload_yt.py", line 9, in
was_uploaded, video_id = upload.upload(
File "E:\TwitchToYT-Test\venv\lib\site-packages\opplast\upload.py", line 164, in upload
public_main_button = modal.find_element_by_name(PUBLIC_BUTTON)
File "E:\TwitchToYT-Test\venv\lib\site-packages\selenium\webdriver\remote\webelement.py", line 209, in find_element_by_name
return self.find_element(by=By.NAME, value=name)
File "E:\TwitchToYT-Test\venv\lib\site-packages\selenium\webdriver\remote\webelement.py", line 658, in find_element
return self._execute(Command.FIND_CHILD_ELEMENT,
File "E:\TwitchToYT-Test\venv\lib\site-packages\selenium\webdriver\remote\webelement.py", line 633, in _execute
return self._parent.execute(command, params)
File "E:\TwitchToYT-Test\venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "E:\TwitchToYT-Test\venv\lib\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: [name="PUBLIC"]

    if not int(publishpolicy) in [0, 1, 2]:
        publishpolicy=0
    if int(publishpolicy) == 0:
        self.log.debug("Trying to set video visibility to private...")

        public_main_button=page.locator(PRIVATE_BUTTON)
        page.locator(PRIVATE_RADIO_LABEL).click()
    elif int(publishpolicy) == 1:
        self.log.debug("Trying to set video visibility to public...")

        public_main_button=page.locator(PUBLIC_BUTTON)
        page.locator(PUBLIC_RADIO_LABEL).click()
    else: