def parser_cookie_file(self, replace=(".com", ".fm")):
     cookie_file = utils.get_cookie_file(self.username)
     if os.path.exists(cookie_file):
         with open(cookie_file, "rw+") as fp:
             new_line = None
             for line in fp:
                 if line.startswith("#HttpOnly_.douban"):
                     new_line = line.replace(replace[0], replace[1])
                     break
             if new_line is not None:    
                 fp.write(new_line)
 def parser_cookie_file(self, replace=(".com", ".fm")):
     cookie_file = utils.get_cookie_file(self.username)
     if os.path.exists(cookie_file):
         with open(cookie_file, "rw+") as fp:
             new_line = None
             for line in fp:
                 if line.startswith("#HttpOnly_.douban"):
                     new_line = line.replace(replace[0], replace[1])
                     break
             if new_line is not None:
                 fp.write(new_line)
Beispiel #3
0
    def __init__(self):
        cookie_file = utils.get_cookie_file()
        cj = cookielib.LWPCookieJar(cookie_file)
        cookie_handler = urllib2.HTTPCookieProcessor(cj)
        opener = urllib2.build_opener(cookie_handler)
        opener.addheaders = [
            (
                "User-agent",
                "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/535.24 "
                "(KHTML, like Gecko) Chrome/19.0.1056.0 Safari/535.24",
            )
        ]
        self.cookiejar = cj
        if os.path.isfile(cookie_file):
            self.cookiejar.load(ignore_discard=True, ignore_expires=True)
        self.opener = opener

        self.apidata = {}
Beispiel #4
0
    def __init__(self, username, password):
        self.username = username
        self.password = password

        # 保存cookie
        cookie_file = utils.get_cookie_file(username)
        cj = cookielib.LWPCookieJar(cookie_file)
        cookie_handler = urllib2.HTTPCookieProcessor(cj)
        opener = urllib2.build_opener(cookie_handler)
        opener.addheaders = [
            ('User-agent', 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/535.24 ' \
             '(KHTML, like Gecko) Chrome/19.0.1056.0 Safari/535.24'),]
        self.cookiejar = cj
        if os.path.isfile(cookie_file):
            self.cookiejar.load(ignore_discard=True, ignore_expires=True)

        self.opener = opener
        self.apidata = dict()
        self.__pickack = ""
        self.user_info = {}
        self.login_verify_code = ""
Beispiel #5
0
 def __init__(self, username, password):
     self.username = username
     self.password = password
     
     # 保存cookie
     cookie_file = utils.get_cookie_file(username)
     cj = cookielib.LWPCookieJar(cookie_file)
     cookie_handler = urllib2.HTTPCookieProcessor(cj)
     opener = urllib2.build_opener(cookie_handler)
     opener.addheaders = [
         ('User-agent', 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/535.24 ' \
          '(KHTML, like Gecko) Chrome/19.0.1056.0 Safari/535.24'),]
     self.cookiejar = cj
     if os.path.isfile(cookie_file):
         self.cookiejar.load(ignore_discard=True, ignore_expires=True)
     
     self.opener = opener
     self.apidata = dict()
     self.__pickack = ""
     self.user_info = {}
     self.login_verify_code = ""
Beispiel #6
0
 def __init__(self, username, password):
     self.cookie_file = utils.get_cookie_file(username)
     self.curl = Curl(self.cookie_file)
     self.username = username
     self.password = password
     self.__bduss = None
Beispiel #7
0
 def __init__(self, username, password):
     self.cookie_file = utils.get_cookie_file(username)
     self.curl = Curl(self.cookie_file)
     self.username = username
     self.password = password
     self.__bduss = None
 def load_user_cookie(self):    
     cookie_file = utils.get_cookie_file(self.username)
     self.mycurl.set_cookie_file(cookie_file)
 def load_user_cookie(self):
     cookie_file = utils.get_cookie_file(self.username)
     self.mycurl.set_cookie_file(cookie_file)