From 1cb0095536b1263da82282f23476bc28a13e1995 Mon Sep 17 00:00:00 2001 From: James Taylor Date: Wed, 26 Dec 2018 20:07:10 -0800 Subject: Fix cookiejar_from_lwp function --- youtube/accounts.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'youtube') diff --git a/youtube/accounts.py b/youtube/accounts.py index 6959fb2..7bb5ec5 100644 --- a/youtube/accounts.py +++ b/youtube/accounts.py @@ -37,10 +37,11 @@ def add_account(username, password, save): return successful def cookiejar_from_lwp_str(lwp_str): + lwp_str = "#LWP-Cookies-2.0\n" + lwp_str # header required by _really_load for reading from "file" cookiejar = http.cookiejar.LWPCookieJar() # HACK: cookiejar module insists on using filenames and reading files for you, # so present a StringIO to this internal method which takes a filelike object - cookiejar._really_load(self, io.StringIO(lwp_str), "", False, False) + cookiejar._really_load(io.StringIO(lwp_str), "", False, False) return cookiejar def account_cookiejar(username): -- cgit v1.2.3