2
import base64
base64_message = 'aHR0cHM6Ly9mb3Jtcy5nbGUvWU5ZXQ0d2NRWHVLNnNwdjU='

This string has a noise but I can't find it so that I can't decode it...

base64_bytes = base64_message.encode('UTF-8')
message_bytes = base64.b64decode(base64_bytes)
message = message_bytes.decode('UTF-8')
print(message)
Tấn Nguyên
  • 1,607
  • 4
  • 15
  • 25

2 Answers2

0

You need to pad your base64 string first. You may see more about this in wikipedia and in this answer

After that, you will encounter another error:

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd8 in position 24: invalid continuation byte

You can change the error handler like this:

message = message_bytes.decode('UTF-8', 'replace')

but I suppose that your base64 string is broken at the beginning.

wankata
  • 855
  • 4
  • 12
0

1st decode your string('aHR0cHM6Ly9mb3Jtcy5nbGUvWU5ZXQ0d2NRWHVLNnNwdjU=') base 64 you will get something like

https://forms.gle/YNY]VR͜

Now think, a URL only contains words and numbers and '/'. so make a method where u can remove the character not supposed to be URL. Then ur URL become like this

https://forms.gle/YNYVR

Cody Gray - on strike
  • 239,200
  • 50
  • 490
  • 574
SAM
  • 58
  • 6