From 67a6b9bc45ef015c8bc0184ad4cbda6cc7d6c4b4 Mon Sep 17 00:00:00 2001 From: Mort Yao Date: Sat, 17 Oct 2015 04:28:32 +0200 Subject: [PATCH] [common] if it's not moz_cookies, pass --- src/you_get/common.py | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/src/you_get/common.py b/src/you_get/common.py index 094c77a1..c704e406 100755 --- a/src/you_get/common.py +++ b/src/you_get/common.py @@ -936,18 +936,23 @@ def script_main(script_name, download, download_playlist = None): cookies = cookiejar.MozillaCookieJar() con = sqlite3.connect(a) cur = con.cursor() - cur.execute("SELECT host, path, isSecure, expiry, name, value FROM moz_cookies") - for item in cur.fetchall(): - c = cookiejar.Cookie(0, item[4], item[5], - None, False, - item[0], - item[0].startswith('.'), - item[0].startswith('.'), - item[1], False, - item[2], - item[3], item[3]=="", - None, None, {}) - cookies.set_cookie(c) + try: + cur.execute("SELECT host, path, isSecure, expiry, name, value FROM moz_cookies") + for item in cur.fetchall(): + c = cookiejar.Cookie(0, item[4], item[5], + None, False, + item[0], + item[0].startswith('.'), + item[0].startswith('.'), + item[1], False, + item[2], + item[3], item[3]=="", + None, None, {}) + cookies.set_cookie(c) + except: pass + # TODO: Chromium Cookies + # SELECT host_key, path, secure, expires_utc, name, encrypted_value FROM cookies + # http://n8henrie.com/2013/11/use-chromes-cookies-for-easier-downloading-with-python-requests/ elif o in ('-l', '--playlist'): playlist = True