Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from base64 import b64decode
- from urllib.parse import urlparse, unquote
- def parse_query(query):
- return dict(item.split("=", maxsplit=1) for item in unquote(query).split("&"))
- def query(url):
- query = urlparse(url).query
- result = parse_query(query)
- # if spLa exists, it's a base64 encoded string
- # decoding it and creating a sub-dict of it
- if "spLa" in result:
- result["spLa"] = parse_query(b64decode(result["spLa"]))
- return result
Add Comment
Please, Sign In to add comment