JasonLovesDoggo / RedditVideoMakerBot

Create Reddit Videos with just✨ one command ✨
GNU General Public License v3.0
23 stars 13 forks source link

SSL error - Max retries #64

Closed stopmoclay closed 2 years ago

stopmoclay commented 2 years ago

The edits made to this bot already are INCREDIBLE and I can't thank the dev enough

However, getting the current error, would love some insight:

File "C:\Python310\lib\site-packages\urllib3\connectionpool.py", line 703, in urlopen
    httplib_response = self._make_request(
  File "C:\Python310\lib\site-packages\urllib3\connectionpool.py", line 386, in _make_request
    self._validate_conn(conn)
  File "C:\Python310\lib\site-packages\urllib3\connectionpool.py", line 1040, in _validate_conn
    conn.connect()
  File "C:\Python310\lib\site-packages\urllib3\connection.py", line 414, in connect
    self.sock = ssl_wrap_socket(
  File "C:\Python310\lib\site-packages\urllib3\util\ssl_.py", line 449, in ssl_wrap_socket
    ssl_sock = _ssl_wrap_socket_impl(
  File "C:\Python310\lib\site-packages\urllib3\util\ssl_.py", line 493, in _ssl_wrap_socket_impl
    return ssl_context.wrap_socket(sock, server_hostname=server_hostname)
  File "C:\Python310\lib\ssl.py", line 512, in wrap_socket
    return self.sslsocket_class._create(
  File "C:\Python310\lib\ssl.py", line 1070, in _create
    self.do_handshake()
  File "C:\Python310\lib\ssl.py", line 1341, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLError: [SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:997)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Python310\lib\site-packages\requests\adapters.py", line 440, in send
    resp = conn.urlopen(
  File "C:\Python310\lib\site-packages\urllib3\connectionpool.py", line 785, in urlopen
    retries = retries.increment(
  File "C:\Python310\lib\site-packages\urllib3\util\retry.py", line 592, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='api16-normal-useast5.us.tiktokv.com', port=443): Max retries exceeded with url: /media/api/text/speech/invoke/?text_speaker=en_us_001&req_text=I+think+it's+because+of+the+AskReddit+videos+on+YouTube.&speaker_map_type=0 (Caused by SSLError(SSLError(1, '[SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:997)')))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Lucas\Documents\GitHub\JasonLovesDoggoRedditVideoMakerBot\RedditVideoMakerBot\main.py", line 60, in <module>
    main()
  File "C:\Users\Lucas\Documents\GitHub\JasonLovesDoggoRedditVideoMakerBot\RedditVideoMakerBot\main.py", line 39, in main
    length, number_of_comments = save_text_to_mp3(reddit_object)
  File "C:\Users\Lucas\Documents\GitHub\JasonLovesDoggoRedditVideoMakerBot\RedditVideoMakerBot\video_creation\voices.py", line 39, in save_text_to_mp3
    ttttsw.tts(sanitize_text(comment["comment_body"]), filename=f"assets/temp/mp3/{com}.mp3", random_speaker=False)
  File "C:\Users\Lucas\Documents\GitHub\JasonLovesDoggoRedditVideoMakerBot\RedditVideoMakerBot\video_creation\TTSwrapper.py", line 81, in tts
    r = requests.post(f"{self.URI_BASE}{voice}&req_text={chunk}&speaker_map_type=0")
  File "C:\Python310\lib\site-packages\requests\api.py", line 117, in post
    return request('post', url, data=data, json=json, **kwargs)
  File "C:\Python310\lib\site-packages\requests\api.py", line 61, in request
    return session.request(method=method, url=url, **kwargs)
  File "C:\Python310\lib\site-packages\requests\sessions.py", line 529, in request
    resp = self.send(prep, **send_kwargs)
  File "C:\Python310\lib\site-packages\requests\sessions.py", line 645, in send
    r = adapter.send(request, **kwargs)
  File "C:\Python310\lib\site-packages\requests\adapters.py", line 517, in send
    raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='api16-normal-useast5.us.tiktokv.com', port=443): Max retries exceeded with url: /media/api/text/speech/invoke/?text_speaker=en_us_001&req_text=I+think+it's+because+of+the+AskReddit+videos+on+YouTube.&speaker_map_type=0 (Caused by SSLError(SSLError(1, '[SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:997)')))
JasonLovesDoggo commented 2 years ago

The edits made to this bot already are INCREDIBLE and I can't thank the dev enough

Thanks :D

JasonLovesDoggo commented 2 years ago

as for the error... https://stackoverflow.com/questions/23013220/max-retries-exceeded-with-url-in-requests

will be implementing this https://stackoverflow.com/a/47475019/18516611 right now

stopmoclay commented 2 years ago

Fantastic! One other issue I've had a few times comes from downloading the youtube videos, see below:

Downloading parkour.mp4 from https://www.youtube.com/watch?v=n_Dv4JMiwK8
Traceback (most recent call last):
  File "C:\Python310\lib\site-packages\pytube\__main__.py", line 181, in fmt_streams
    extract.apply_signature(stream_manifest, self.vid_info, self.js)
  File "C:\Python310\lib\site-packages\pytube\extract.py", line 409, in apply_signature
    cipher = Cipher(js=js)
  File "C:\Python310\lib\site-packages\pytube\cipher.py", line 33, in __init__
    raise RegexMatchError(
pytube.exceptions.RegexMatchError: __init__: could not find match for ^\w+\W

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Lucas\Documents\GitHub\JasonLovesDoggoRedditVideoMakerBot\RedditVideoMakerBot\main.py", line 62, in <module>
    main()
  File "C:\Users\Lucas\Documents\GitHub\JasonLovesDoggoRedditVideoMakerBot\RedditVideoMakerBot\main.py", line 42, in main
    download_background()
  File "C:\Users\Lucas\Documents\GitHub\JasonLovesDoggoRedditVideoMakerBot\RedditVideoMakerBot\video_creation\background.py", line 37, in download_background
    YouTube(uri).streams.filter(res="1080p").first().download(
  File "C:\Python310\lib\site-packages\pytube\__main__.py", line 296, in streams
    return StreamQuery(self.fmt_streams)
  File "C:\Python310\lib\site-packages\pytube\__main__.py", line 188, in fmt_streams
    extract.apply_signature(stream_manifest, self.vid_info, self.js)
  File "C:\Python310\lib\site-packages\pytube\extract.py", line 409, in apply_signature
    cipher = Cipher(js=js)
  File "C:\Python310\lib\site-packages\pytube\cipher.py", line 33, in __init__
    raise RegexMatchError(
pytube.exceptions.RegexMatchError: __init__: could not find match for ^\w+\W
JasonLovesDoggo commented 2 years ago

Fantastic! One other issue I've had a few times comes from downloading the youtube videos, see below:

Downloading parkour.mp4 from https://www.youtube.com/watch?v=n_Dv4JMiwK8
Traceback (most recent call last):
  File "C:\Python310\lib\site-packages\pytube\__main__.py", line 181, in fmt_streams
    extract.apply_signature(stream_manifest, self.vid_info, self.js)
  File "C:\Python310\lib\site-packages\pytube\extract.py", line 409, in apply_signature
    cipher = Cipher(js=js)
  File "C:\Python310\lib\site-packages\pytube\cipher.py", line 33, in __init__
    raise RegexMatchError(
pytube.exceptions.RegexMatchError: __init__: could not find match for ^\w+\W

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Lucas\Documents\GitHub\JasonLovesDoggoRedditVideoMakerBot\RedditVideoMakerBot\main.py", line 62, in <module>
    main()
  File "C:\Users\Lucas\Documents\GitHub\JasonLovesDoggoRedditVideoMakerBot\RedditVideoMakerBot\main.py", line 42, in main
    download_background()
  File "C:\Users\Lucas\Documents\GitHub\JasonLovesDoggoRedditVideoMakerBot\RedditVideoMakerBot\video_creation\background.py", line 37, in download_background
    YouTube(uri).streams.filter(res="1080p").first().download(
  File "C:\Python310\lib\site-packages\pytube\__main__.py", line 296, in streams
    return StreamQuery(self.fmt_streams)
  File "C:\Python310\lib\site-packages\pytube\__main__.py", line 188, in fmt_streams
    extract.apply_signature(stream_manifest, self.vid_info, self.js)
  File "C:\Python310\lib\site-packages\pytube\extract.py", line 409, in apply_signature
    cipher = Cipher(js=js)
  File "C:\Python310\lib\site-packages\pytube\cipher.py", line 33, in __init__
    raise RegexMatchError(
pytube.exceptions.RegexMatchError: __init__: could not find match for ^\w+\W

see #42

JasonLovesDoggo commented 2 years ago

also the fix is done im just testing it rn

stopmoclay commented 2 years ago

Fantastic! One other issue I've had a few times comes from downloading the youtube videos, see below:

Downloading parkour.mp4 from https://www.youtube.com/watch?v=n_Dv4JMiwK8
Traceback (most recent call last):
  File "C:\Python310\lib\site-packages\pytube\__main__.py", line 181, in fmt_streams
    extract.apply_signature(stream_manifest, self.vid_info, self.js)
  File "C:\Python310\lib\site-packages\pytube\extract.py", line 409, in apply_signature
    cipher = Cipher(js=js)
  File "C:\Python310\lib\site-packages\pytube\cipher.py", line 33, in __init__
    raise RegexMatchError(
pytube.exceptions.RegexMatchError: __init__: could not find match for ^\w+\W

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Lucas\Documents\GitHub\JasonLovesDoggoRedditVideoMakerBot\RedditVideoMakerBot\main.py", line 62, in <module>
    main()
  File "C:\Users\Lucas\Documents\GitHub\JasonLovesDoggoRedditVideoMakerBot\RedditVideoMakerBot\main.py", line 42, in main
    download_background()
  File "C:\Users\Lucas\Documents\GitHub\JasonLovesDoggoRedditVideoMakerBot\RedditVideoMakerBot\video_creation\background.py", line 37, in download_background
    YouTube(uri).streams.filter(res="1080p").first().download(
  File "C:\Python310\lib\site-packages\pytube\__main__.py", line 296, in streams
    return StreamQuery(self.fmt_streams)
  File "C:\Python310\lib\site-packages\pytube\__main__.py", line 188, in fmt_streams
    extract.apply_signature(stream_manifest, self.vid_info, self.js)
  File "C:\Python310\lib\site-packages\pytube\extract.py", line 409, in apply_signature
    cipher = Cipher(js=js)
  File "C:\Python310\lib\site-packages\pytube\cipher.py", line 33, in __init__
    raise RegexMatchError(
pytube.exceptions.RegexMatchError: __init__: could not find match for ^\w+\W

see #42

Hmm getting the following error now

Downloading parkour.mp4 from https://www.youtube.com/watch?v=n_Dv4JMiwK8
Traceback (most recent call last):
  File "C:\Users\Lucas\Documents\GitHub\JasonLovesDoggoRedditVideoMakerBot\RedditVideoMakerBot\main.py", line 62, in <module>
    main()
  File "C:\Users\Lucas\Documents\GitHub\JasonLovesDoggoRedditVideoMakerBot\RedditVideoMakerBot\main.py", line 42, in main
    download_background()
  File "C:\Users\Lucas\Documents\GitHub\JasonLovesDoggoRedditVideoMakerBot\RedditVideoMakerBot\video_creation\background.py", line 37, in download_background
    YouTube(uri).streams.filter(res="1080p").first().download(
  File "C:\Python310\lib\site-packages\pytube\__main__.py", line 296, in streams
    return StreamQuery(self.fmt_streams)
  File "C:\Python310\lib\site-packages\pytube\__main__.py", line 181, in fmt_streams
    extract.apply_signature(stream_manifest, self.vid_info, self.js)
  File "C:\Python310\lib\site-packages\pytube\extract.py", line 409, in apply_signature
    cipher = Cipher(js=js)
  File "C:\Python310\lib\site-packages\pytube\cipher.py", line 30, in __init__
    var_regex = re.compile(r"^$*\w+\W")
  File "C:\Python310\lib\re.py", line 251, in compile
    return _compile(pattern, flags)
  File "C:\Python310\lib\re.py", line 303, in _compile
    p = sre_compile.compile(pattern, flags)
  File "C:\Python310\lib\sre_compile.py", line 764, in compile
    p = sre_parse.parse(p, flags)
  File "C:\Python310\lib\sre_parse.py", line 950, in parse
    p = _parse_sub(source, state, flags & SRE_FLAG_VERBOSE, 0)
  File "C:\Python310\lib\sre_parse.py", line 443, in _parse_sub
    itemsappend(_parse(source, state, verbose, nested + 1,
  File "C:\Python310\lib\sre_parse.py", line 668, in _parse
    raise source.error("nothing to repeat",
re.error: nothing to repeat at position 2
JasonLovesDoggo commented 2 years ago

I just fixed that error. can you reclone the repo?

stopmoclay commented 2 years ago

I just fixed that error. can you reclone the repo?

I'm still getting the same error even after editing cypher.py, can't figure it out. Also recloned the repo

JasonLovesDoggo commented 2 years ago

Are you sure you saved the file?

stopmoclay commented 2 years ago

Yes, Cypher.py current has "var_regex = re.compile(r"^$*\w+\W")"

If I change it back and save, I get a different error also

JasonLovesDoggo commented 2 years ago

Can you tell me the exact error that you have with the updated file

stopmoclay commented 2 years ago
Downloading the backgrounds videos... please be patient 🙏
Downloading parkour.mp4 from https://www.youtube.com/watch?v=n_Dv4JMiwK8
Traceback (most recent call last):
  File "C:\Users\Lucas\Documents\GitHub\JasonLovesDoggoRedditVideoMakerBot\RedditVideoMakerBot\main.py", line 62, in <module>
    main()
  File "C:\Users\Lucas\Documents\GitHub\JasonLovesDoggoRedditVideoMakerBot\RedditVideoMakerBot\main.py", line 42, in main
    download_background()
  File "C:\Users\Lucas\Documents\GitHub\JasonLovesDoggoRedditVideoMakerBot\RedditVideoMakerBot\video_creation\background.py", line 37, in download_background
    YouTube(uri).streams.filter(res="1080p").first().download(
  File "C:\Python310\lib\site-packages\pytube\__main__.py", line 296, in streams
    return StreamQuery(self.fmt_streams)
  File "C:\Python310\lib\site-packages\pytube\__main__.py", line 181, in fmt_streams
    extract.apply_signature(stream_manifest, self.vid_info, self.js)
  File "C:\Python310\lib\site-packages\pytube\extract.py", line 409, in apply_signature
    cipher = Cipher(js=js)
  File "C:\Python310\lib\site-packages\pytube\cipher.py", line 30, in __init__
    var_regex = re.compile(r"^$*\w+\W")
  File "C:\Python310\lib\re.py", line 251, in compile
    return _compile(pattern, flags)
  File "C:\Python310\lib\re.py", line 303, in _compile
    p = sre_compile.compile(pattern, flags)
  File "C:\Python310\lib\sre_compile.py", line 764, in compile
    p = sre_parse.parse(p, flags)
  File "C:\Python310\lib\sre_parse.py", line 950, in parse
    p = _parse_sub(source, state, flags & SRE_FLAG_VERBOSE, 0)
  File "C:\Python310\lib\sre_parse.py", line 443, in _parse_sub
    itemsappend(_parse(source, state, verbose, nested + 1,
  File "C:\Python310\lib\sre_parse.py", line 668, in _parse
    raise source.error("nothing to repeat",
re.error: nothing to repeat at position 2
JasonLovesDoggo commented 2 years ago
Downloading the backgrounds videos... please be patient 🙏
Downloading parkour.mp4 from https://www.youtube.com/watch?v=n_Dv4JMiwK8
Traceback (most recent call last):
  File "C:\Users\Lucas\Documents\GitHub\JasonLovesDoggoRedditVideoMakerBot\RedditVideoMakerBot\main.py", line 62, in <module>
    main()
  File "C:\Users\Lucas\Documents\GitHub\JasonLovesDoggoRedditVideoMakerBot\RedditVideoMakerBot\main.py", line 42, in main
    download_background()
  File "C:\Users\Lucas\Documents\GitHub\JasonLovesDoggoRedditVideoMakerBot\RedditVideoMakerBot\video_creation\background.py", line 37, in download_background
    YouTube(uri).streams.filter(res="1080p").first().download(
  File "C:\Python310\lib\site-packages\pytube\__main__.py", line 296, in streams
    return StreamQuery(self.fmt_streams)
  File "C:\Python310\lib\site-packages\pytube\__main__.py", line 181, in fmt_streams
    extract.apply_signature(stream_manifest, self.vid_info, self.js)
  File "C:\Python310\lib\site-packages\pytube\extract.py", line 409, in apply_signature
    cipher = Cipher(js=js)
  File "C:\Python310\lib\site-packages\pytube\cipher.py", line 30, in __init__
    var_regex = re.compile(r"^$*\w+\W")
  File "C:\Python310\lib\re.py", line 251, in compile
    return _compile(pattern, flags)
  File "C:\Python310\lib\re.py", line 303, in _compile
    p = sre_compile.compile(pattern, flags)
  File "C:\Python310\lib\sre_compile.py", line 764, in compile
    p = sre_parse.parse(p, flags)
  File "C:\Python310\lib\sre_parse.py", line 950, in parse
    p = _parse_sub(source, state, flags & SRE_FLAG_VERBOSE, 0)
  File "C:\Python310\lib\sre_parse.py", line 443, in _parse_sub
    itemsappend(_parse(source, state, verbose, nested + 1,
  File "C:\Python310\lib\sre_parse.py", line 668, in _parse
    raise source.error("nothing to repeat",
re.error: nothing to repeat at position 2

try swapping instead re.compile(r"^\$*\w+\W") It's slightly different but it might work

stopmoclay commented 2 years ago
Downloading the backgrounds videos... please be patient 🙏
Downloading parkour.mp4 from https://www.youtube.com/watch?v=n_Dv4JMiwK8
Traceback (most recent call last):
  File "C:\Users\Lucas\Documents\GitHub\JasonLovesDoggoRedditVideoMakerBot\RedditVideoMakerBot\main.py", line 62, in <module>
    main()
  File "C:\Users\Lucas\Documents\GitHub\JasonLovesDoggoRedditVideoMakerBot\RedditVideoMakerBot\main.py", line 42, in main
    download_background()
  File "C:\Users\Lucas\Documents\GitHub\JasonLovesDoggoRedditVideoMakerBot\RedditVideoMakerBot\video_creation\background.py", line 37, in download_background
    YouTube(uri).streams.filter(res="1080p").first().download(
  File "C:\Python310\lib\site-packages\pytube\__main__.py", line 296, in streams
    return StreamQuery(self.fmt_streams)
  File "C:\Python310\lib\site-packages\pytube\__main__.py", line 181, in fmt_streams
    extract.apply_signature(stream_manifest, self.vid_info, self.js)
  File "C:\Python310\lib\site-packages\pytube\extract.py", line 409, in apply_signature
    cipher = Cipher(js=js)
  File "C:\Python310\lib\site-packages\pytube\cipher.py", line 30, in __init__
    var_regex = re.compile(r"^$*\w+\W")
  File "C:\Python310\lib\re.py", line 251, in compile
    return _compile(pattern, flags)
  File "C:\Python310\lib\re.py", line 303, in _compile
    p = sre_compile.compile(pattern, flags)
  File "C:\Python310\lib\sre_compile.py", line 764, in compile
    p = sre_parse.parse(p, flags)
  File "C:\Python310\lib\sre_parse.py", line 950, in parse
    p = _parse_sub(source, state, flags & SRE_FLAG_VERBOSE, 0)
  File "C:\Python310\lib\sre_parse.py", line 443, in _parse_sub
    itemsappend(_parse(source, state, verbose, nested + 1,
  File "C:\Python310\lib\sre_parse.py", line 668, in _parse
    raise source.error("nothing to repeat",
re.error: nothing to repeat at position 2

try swapping instead re.compile(r"^\$*\w+\W") It's slightly different but it might work

This worked! Thank you!

JasonLovesDoggo commented 2 years ago

Glad I could help!