7x11x13 / songs-to-youtube

Desktop application alternative to sites like TunesToTube, audioship, tovid.io, etc
https://pypi.org/project/songs-to-youtube/
210 stars 12 forks source link

Videos render but don't upload - "Bad Request for url: https://studio.youtube.com..." #57

Open thekirbykid20067 opened 6 months ago

thekirbykid20067 commented 6 months ago

Videos render fine, but the upload process always gets stuck at "Uploading video file".

Full log:

[17:23:38] [DEBUG] {'date': ['2021'], 'albumartist': ['dababy2015murder'], 'artist': ['dababy2015murder'], 'tracknumber': ['1'], 'album': ['the answer to all your problems'], 'title': ['the worst fart in my entire life'], 'comment': ['Visit https://damurderofdababy.bandcamp.com']}
[17:23:38] [DEBUG] Tags: ['date', 'albumartist', 'artist', 'tracknumber', 'album', 'title', 'comment']
[17:23:38] [INFO] Found cover file C:/Users/haylee/Music/dababy2015murder/the answer to all your problems/cover.png
[17:23:38] [DEBUG] {'date': ['2021'], 'albumartist': ['dababy2015murder'], 'artist': ['dababy2015murder'], 'tracknumber': ['2'], 'album': ['the answer to all your problems'], 'title': ['one of the better ones'], 'comment': ['Visit https://damurderofdababy.bandcamp.com']}
[17:23:38] [DEBUG] Tags: ['date', 'albumartist', 'artist', 'tracknumber', 'album', 'title', 'comment']
[17:23:38] [INFO] Found cover file C:/Users/haylee/Music/dababy2015murder/the answer to all your problems/cover.png
[17:23:38] [DEBUG] {'date': ['2021'], 'albumartist': ['dababy2015murder'], 'artist': ['dababy2015murder'], 'tracknumber': ['3'], 'album': ['the answer to all your problems'], 'title': ['a whole baby came out of my ass'], 'comment': ['Visit https://damurderofdababy.bandcamp.com']}
[17:23:38] [DEBUG] Tags: ['date', 'albumartist', 'artist', 'tracknumber', 'album', 'title', 'comment']
[17:23:38] [INFO] Found cover file C:/Users/haylee/Music/dababy2015murder/the answer to all your problems/cover.png
[17:24:19] [DEBUG] Duration (ms): 43026.439909297056
[17:24:19] [DEBUG] Duration (ms): 59057.641723356006
[17:24:19] [DEBUG] Duration (ms): 35942.199546485266
[17:24:19] [DEBUG] Duration (ms): 43026.439909297056
[17:24:19] [DEBUG] Duration (ms): 59057.641723356006
[17:24:19] [DEBUG] Duration (ms): 35942.199546485266
[17:24:19] [DEBUG] Duration (ms): 43026.439909297056
[17:24:19] [DEBUG] Duration (ms): 59057.641723356006
[17:24:19] [DEBUG] Duration (ms): 35942.199546485266
[17:24:20] [DEBUG] Duration (ms): 35942.199546485266
[17:24:20] [DEBUG] Duration (ms): 43026.439909297056
[17:24:20] [DEBUG] Duration (ms): 59057.641723356006
[17:24:20] [DEBUG] Duration (ms): 35942.199546485266
[17:24:20] [DEBUG] Duration (ms): 59057.641723356006
[17:24:20] [DEBUG] Duration (ms): 43026.439909297056
[17:24:20] [DEBUG] Duration (ms): 43026.439909297056
[17:24:21] [SUCCESS] C:/Users/haylee/Music/dababy2015murder/the answer to all your problems/dababy2015murder - the answer to all your problems - 01 the worst fart in my entire life.flac.mkv - Done rendering
[17:24:21] [DEBUG] C:/Users/haylee/Music/dababy2015murder/the answer to all your problems/dababy2015murder - the answer to all your problems - 01 the worst fart in my entire life.flac.mkv finished, success: True
[17:24:21] [DEBUG] Duration (ms): 35942.199546485266
[17:24:21] [DEBUG] Duration (ms): 59057.641723356006
[17:24:21] [SUCCESS] C:/Users/haylee/Music/dababy2015murder/the answer to all your problems/dababy2015murder - the answer to all your problems - 02 one of the better ones.flac.mkv - Done rendering
[17:24:21] [DEBUG] C:/Users/haylee/Music/dababy2015murder/the answer to all your problems/dababy2015murder - the answer to all your problems - 02 one of the better ones.flac.mkv finished, success: True
[17:24:21] [SUCCESS] C:/Users/haylee/Music/dababy2015murder/the answer to all your problems/dababy2015murder - the answer to all your problems - 03 a whole baby came out of my ass.flac.mkv - Done rendering
[17:24:21] [DEBUG] C:/Users/haylee/Music/dababy2015murder/the answer to all your problems/dababy2015murder - the answer to all your problems - 03 a whole baby came out of my ass.flac.mkv finished, success: True
[17:24:21] [SUCCESS] 3/3 renders successful
[17:24:21] [DEBUG] Metadata(title='dababy2015murder - the worst fart in my entire life', description='dababy2015murder - the worst fart in my entire life\n\nTrack 1 from the answer to all your problems, released October 26, 2021\nPlaylist: https://www.youtube.com/playlist?list=PL2JU9mz1czP9N9HXdglRLc-A2litZLArF\nhttps://damurderofdababy.bandcamp.com/album/the-answer-to-all-your-problems', privacy='PUBLIC', made_for_kids=False, tags=[], scheduled_upload=None, premiere_countdown_duration=None, premiere_theme=None, playlist_ids=None, playlists=[Playlist(title='dababy2015murder - the answer to all your problems', description='', privacy='PUBLIC', create_if_title_exists=False, create_if_title_doesnt_exist=True)], thumbnail=None, publish_to_feed=True, category=None, auto_chapter=None, auto_places=None, auto_concepts=None, has_product_placement=None, show_product_placement_overlay=None, recorded_date=None, restricted_to_over_18=None, audio_language=None, captions_files=None, license=None, allow_comments=None, allow_comments_mode=None, can_view_ratings=None, comments_sort_order=None, allow_embedding=None)
[17:24:21] [INFO] Starting upload
[17:24:21] [INFO] Getting session data
[17:24:21] [INFO] Getting upload URL
[17:24:21] [INFO] Uploading video file
[17:29:38] [ERROR] Traceback (most recent call last):
  File "youtube_up\uploader.py", line 146, in upload
  File "youtube_up\uploader.py", line 460, in _create_video
  File "requests\models.py", line 1021, in raise_for_status
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://studio.youtube.com/youtubei/v1/upload/createvideo?key=AIzaSyBUPetSUmoZL-OhlxA7wSac5XinrygCqMo&alt=json

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "upload.py", line 160, in run
  File "youtube_up\uploader.py", line 152, in upload
  File "youtube_up\uploader.py", line 256, in _get_session_token
  File "selenium\webdriver\remote\webdriver.py", line 356, in get
  File "selenium\webdriver\remote\webdriver.py", line 347, in execute
  File "selenium\webdriver\remote\errorhandler.py", line 229, in check_response
selenium.common.exceptions.TimeoutException: Message: Navigation timed out after 300000 ms
Stacktrace:
RemoteError@chrome://remote/content/shared/RemoteError.sys.mjs:8:8
WebDriverError@chrome://remote/content/shared/webdriver/Errors.sys.mjs:193:5
TimeoutError@chrome://remote/content/shared/webdriver/Errors.sys.mjs:740:5
bail@chrome://remote/content/marionette/sync.sys.mjs:211:19
[17:29:38] [ERROR] C:/Users/haylee/Music/dababy2015murder/the answer to all your problems/dababy2015murder - the answer to all your problems - 01 the worst fart in my entire life.flac.mkv - Error while uploading
[17:29:40] [DEBUG] Metadata(title='dababy2015murder - one of the better ones', description='dababy2015murder - one of the better ones\n\nTrack 2 from the answer to all your problems, released October 26, 2021\nPlaylist: https://www.youtube.com/playlist?list=PL2JU9mz1czP9N9HXdglRLc-A2litZLArF\nhttps://damurderofdababy.bandcamp.com/album/the-answer-to-all-your-problems', privacy='PUBLIC', made_for_kids=False, tags=[], scheduled_upload=None, premiere_countdown_duration=None, premiere_theme=None, playlist_ids=None, playlists=[Playlist(title='dababy2015murder - the answer to all your problems', description='', privacy='PUBLIC', create_if_title_exists=False, create_if_title_doesnt_exist=True)], thumbnail=None, publish_to_feed=True, category=None, auto_chapter=None, auto_places=None, auto_concepts=None, has_product_placement=None, show_product_placement_overlay=None, recorded_date=None, restricted_to_over_18=None, audio_language=None, captions_files=None, license=None, allow_comments=None, allow_comments_mode=None, can_view_ratings=None, comments_sort_order=None, allow_embedding=None)
[17:29:40] [INFO] Starting upload
[17:29:41] [INFO] Getting session data
[17:29:41] [INFO] Getting upload URL
[17:29:41] [INFO] Uploading video file
[17:34:51] [ERROR] Traceback (most recent call last):
  File "youtube_up\uploader.py", line 146, in upload
  File "youtube_up\uploader.py", line 460, in _create_video
  File "requests\models.py", line 1021, in raise_for_status
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://studio.youtube.com/youtubei/v1/upload/createvideo?key=AIzaSyBUPetSUmoZL-OhlxA7wSac5XinrygCqMo&alt=json

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "upload.py", line 160, in run
  File "youtube_up\uploader.py", line 152, in upload
  File "youtube_up\uploader.py", line 256, in _get_session_token
  File "selenium\webdriver\remote\webdriver.py", line 356, in get
  File "selenium\webdriver\remote\webdriver.py", line 347, in execute
  File "selenium\webdriver\remote\errorhandler.py", line 229, in check_response
selenium.common.exceptions.TimeoutException: Message: Navigation timed out after 300000 ms
Stacktrace:
RemoteError@chrome://remote/content/shared/RemoteError.sys.mjs:8:8
WebDriverError@chrome://remote/content/shared/webdriver/Errors.sys.mjs:193:5
TimeoutError@chrome://remote/content/shared/webdriver/Errors.sys.mjs:740:5
bail@chrome://remote/content/marionette/sync.sys.mjs:211:19
[17:34:51] [ERROR] C:/Users/haylee/Music/dababy2015murder/the answer to all your problems/dababy2015murder - the answer to all your problems - 02 one of the better ones.flac.mkv - Error while uploading
[17:34:53] [DEBUG] Metadata(title='dababy2015murder - a whole baby came out of my ass', description='dababy2015murder - a whole baby came out of my ass\n\nTrack 3 from the answer to all your problems, released October 26, 2021\nPlaylist: https://www.youtube.com/playlist?list=PL2JU9mz1czP9N9HXdglRLc-A2litZLArF\nhttps://damurderofdababy.bandcamp.com/album/the-answer-to-all-your-problems', privacy='PUBLIC', made_for_kids=False, tags=[], scheduled_upload=None, premiere_countdown_duration=None, premiere_theme=None, playlist_ids=None, playlists=[Playlist(title='dababy2015murder - the answer to all your problems', description='', privacy='PUBLIC', create_if_title_exists=False, create_if_title_doesnt_exist=True)], thumbnail=None, publish_to_feed=True, category=None, auto_chapter=None, auto_places=None, auto_concepts=None, has_product_placement=None, show_product_placement_overlay=None, recorded_date=None, restricted_to_over_18=None, audio_language=None, captions_files=None, license=None, allow_comments=None, allow_comments_mode=None, can_view_ratings=None, comments_sort_order=None, allow_embedding=None)
[17:34:53] [INFO] Starting upload
[17:34:54] [INFO] Getting session data
[17:34:54] [INFO] Getting upload URL
[17:34:54] [INFO] Uploading video file
[17:40:06] [ERROR] Traceback (most recent call last):
  File "youtube_up\uploader.py", line 146, in upload
  File "youtube_up\uploader.py", line 460, in _create_video
  File "requests\models.py", line 1021, in raise_for_status
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://studio.youtube.com/youtubei/v1/upload/createvideo?key=AIzaSyBUPetSUmoZL-OhlxA7wSac5XinrygCqMo&alt=json

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "upload.py", line 160, in run
  File "youtube_up\uploader.py", line 152, in upload
  File "youtube_up\uploader.py", line 256, in _get_session_token
  File "selenium\webdriver\remote\webdriver.py", line 356, in get
  File "selenium\webdriver\remote\webdriver.py", line 347, in execute
  File "selenium\webdriver\remote\errorhandler.py", line 229, in check_response
selenium.common.exceptions.TimeoutException: Message: Navigation timed out after 300000 ms
Stacktrace:
RemoteError@chrome://remote/content/shared/RemoteError.sys.mjs:8:8
WebDriverError@chrome://remote/content/shared/webdriver/Errors.sys.mjs:193:5
TimeoutError@chrome://remote/content/shared/webdriver/Errors.sys.mjs:740:5
bail@chrome://remote/content/marionette/sync.sys.mjs:211:19
[17:40:06] [ERROR] C:/Users/haylee/Music/dababy2015murder/the answer to all your problems/dababy2015murder - the answer to all your problems - 03 a whole baby came out of my ass.flac.mkv - Error while uploading
[17:40:08] [SUCCESS] 0/3 uploads successful

Unchecked "Hide browser while uploading?" and no browser appears. I installed FFmpeg and geckodriver through Scoop. Apologies if the title has the wrong error in it, I'm not too great with reading these logs so I'm not sure which part of it is the main problem.

7x11x13 commented 6 months ago

It looks like it is timing out while trying to visit https://youtube.com/upload, the issue may be an outdated cookies file or network problem, I'm not able to reproduce so try getting a new cookies file and restarting your computer etc.

thekirbykid20067 commented 6 months ago

Strange fix: Re-exported cookies file using Chrome instead of my main browser Firefox. Only works when cookies are generated with Chrome for some reason

7x11x13 commented 6 months ago

How are you exporting cookies in Chrome and Firefox?

thekirbykid20067 commented 6 months ago

Using the same extension for both. I believe it's also linked within songs-to-youtube but I could be wrong https://chromewebstore.google.com/detail/export-cookie-json-file-f/nmckokihipjgplolmcmjakknndddifde?hl=en https://addons.mozilla.org/en-US/firefox/addon/%E3%82%AF%E3%83%83%E3%82%AD%E3%83%BCjson%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB%E5%87%BA%E5%8A%9B-for-puppeteer/

7x11x13 commented 6 months ago

How many times have you tested exporting with both browsers? Do the files look any different from each other? I suspect it might just be inconsistent in general for you (maybe slow internet connection occasionally causing the timeout error). I can try increasing the timeout to see if it works for you

7x11x13 commented 6 months ago

Page load timeout in v0.12.14 is now 60 secs instead of 30 secs, can you try it and see if you get more consistent results?

7x11x13 commented 5 months ago

I think the problem is fixed by following the instructions at https://github.com/7x11x13/songs-to-youtube?tab=readme-ov-file#installing-certificates (BTW make sure you're on the latest version 0.13.0)