CloudFlareStream: binascii.Error: Incorrect padding
See original GitHub issue- I’m reporting a broken site support
- I’ve verified that I’m running youtube-dl version 2020.09.20
- I’ve checked that all provided URLs are alive and playable in a browser
- I’ve checked that all URLs and arguments with special characters are properly quoted or escaped
- I’ve searched the bugtracker for similar issues including closed ones
Verbose log
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['-v', 'https://watch.cloudflarestream.com/eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJraWQiOiJmYTA0YjViMzQ2NDkwYTM5NWJiNzQ1NWFhZTA2YzYwZSIsInN1YiI6Ijg4ZDQxMDhhMzY0MjA3M2VhYmFhZjg3ZGExODJkMjYzIiwiZXhwIjoxNjAwNjA5MzE5fQ.xkRJwLGkt0nZ%5F0BlPiwU7iW4pqb4lKkznbKfAhGg0tGcxSS6ZBA3lcTUwu7W%2DyCFbnAl%2Dhqk3Fn%5FqeQS%5FQydP27qTHpB9iIFFsMtk1tqzGZV5v4yrYDnwLSKzEKvVd6QwJnfABtxH2JdpSNuWlMUiVXFxGWgjOw6QeTNDDklTQYXV%5FNLV7sErSn5CeOPeRRkdXb%2D8ip%5FVOcfk1nDsFoOo4fctFtGP0wYMyY5ae8nhhatydHwevuvJCcEvEfh%2D4qjq9mCZOodevmtSQ4YWmggf4BxtWnDWYrGW8Otp6oqezrR8oY4%2DbKdV6PaqBj49aJdcls6xK7PmM8%5Fvjy3xfm0Mg']
[debug] Encodings: locale cp1252, fs mbcs, out cp437, pref cp1252
[debug] youtube-dl version 2020.09.20
[debug] Python version 3.4.4 (CPython) - Windows-10-10.0.18362
[debug] exe versions: none
[debug] Proxy map: {}
Traceback (most recent call last):
File "__main__.py", line 19, in <module>
File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpksi3o1r1\build\youtube_dl\__init__.py", line 474, in main
File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpksi3o1r1\build\youtube_dl\__init__.py", line 464, in _real_main
File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpksi3o1r1\build\youtube_dl\YoutubeDL.py", line 2019, in download
File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpksi3o1r1\build\youtube_dl\YoutubeDL.py", line 797, in extract_info
File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpksi3o1r1\build\youtube_dl\extractor\common.py", line 532, in extract
File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpksi3o1r1\build\youtube_dl\extractor\cloudflarestream.py", line 57, in _real_extract
File "C:\Python\Python34\lib\base64.py", line 135, in urlsafe_b64decode
File "C:\Python\Python34\lib\base64.py", line 90, in b64decode
binascii.Error: Incorrect padding
Description
Video plays in browser but generates error in youtube-dl.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:8
Top Results From Across the Web
Python: Ignore 'Incorrect padding' error when base64 decoding
You'd get the error: binascii.Error: Invalid base64-encoded string: number of data characters (5) cannot be 1 more than a multiple of 4 ....
Read more >Getting 'incorrect padding' error while running 'subscription ...
Every time subscription-manager command is executed, we get an error 'incorrect padding' error message. Getting 'Incorrect padding' error ...
Read more >Python: Ignore 'Incorrect padding' error when base64 decoding
PYTHON : Python: Ignore ' Incorrect padding ' error when base64 decoding [ Gift : Animated Search Engine ...
Read more >#31895 (Decoding an invalid session data crashes.) – Django
Summary: Process crash after upgrade to 3.1: Incorrect padding → Decoding an invalid session data crashes. Triage Stage: Unreviewed → Accepted. Type ...
Read more >https://gitea.caret.be/jens/youtube-dlc/commit/99a...
... and extract subtitle (#23687) +* [cloudflarestream] Improve extraction + + ... [toutv] Detect invalid login error +* [toutv] Fix authentication (#20261) ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I stumbled accross this one as well and did some digging. Looks like this is caused by cloudflare not properly padding the base64 encoded data that end up in video_id.
A workable fix is to add
import math
to cloudflarestream.py and replace line 57 in the same file with this:video_id.split('.')[1].ljust(math.ceil(len(video_id.split('.')[1])/4)*4, '=')
Basically we’ll just pad the string going to urlsafe_b64decode ourselves so that the decoder is happy.
~Having the same problem but the fix mentioned here does not work for me. Any chance anyone could create a working fork of this?~ nvm… python2 was my problem here