diff options
-rw-r--r-- | Plugins/ZippyshareCom.py | 9 | ||||
-rwxr-xr-x | module/network/Request.py | 28 | ||||
-rw-r--r-- | module/thread_list.py | 4 |
3 files changed, 30 insertions, 11 deletions
diff --git a/Plugins/ZippyshareCom.py b/Plugins/ZippyshareCom.py index 4e69a5155..d61841ab0 100644 --- a/Plugins/ZippyshareCom.py +++ b/Plugins/ZippyshareCom.py @@ -26,7 +26,7 @@ class ZippyshareCom(Plugin): def download_html(self): url = self.parent.url - self.html = self.req.load(url) + self.html = self.req.load(url, cookies=True) self.time_plus_wait = time() + 12 def get_file_url(self): @@ -35,7 +35,7 @@ class ZippyshareCom(Plugin): if self.html == None: self.download_html() if not self.want_reconnect: - file_url = urllib.unquote(re.search("var comeonguys = 'fck(.*)';", self.html).group(1)) + file_url = urllib.unquote(re.search("var \w* = 'fck(.*)';", self.html).group(1)) return file_url else: return False @@ -45,7 +45,6 @@ class ZippyshareCom(Plugin): self.download_html() if not self.want_reconnect: file_name = re.search("<strong>Name: </strong>(.*)</font><br />", self.html).group(1) - print "zippy",file_name return file_name else: return self.parent.url @@ -59,3 +58,7 @@ class ZippyshareCom(Plugin): return False else: return True + + def proceed(self, url, location): + + self.req.download(url, location, cookies=True) diff --git a/module/network/Request.py b/module/network/Request.py index cce89f92e..2b3545dd8 100755 --- a/module/network/Request.py +++ b/module/network/Request.py @@ -71,12 +71,9 @@ class Request: url = url + get req = urllib2.Request(url, data=post) - - if ref and self.lastURL is not None: req.add_header("Referer", self.lastURL) - if cookies: self.add_cookies(req) #add cookies @@ -112,17 +109,36 @@ class Request: self.opener.add_handler(handler) self.downloader.add_handler(handler) - def download(self, url, filename, post={}): + def download(self, url, filename, get={}, post={}, ref=True, cookies=False): if post: post = urllib.urlencode(post) else: post = None + if get: + get = urllib.urlencode(get) + else: + get = "" + + url = url + get + req = urllib2.Request(url, data=post) + + if ref and self.lastURL is not None: + req.add_header("Referer", self.lastURL) + + if cookies: + self.add_cookies(req) + #add cookies + + rep = self.opener.open(req) + + for cookie in self.cj.make_cookies(rep, req): + self.cookies.append(cookie) + if not self.dl: self.dl = True file = open(filename, 'wb') - req = urllib2.Request(url) conn = self.downloader.open(req, post) if conn.headers.has_key("content-length"): self.dl_size = int(conn.headers["content-length"]) @@ -155,4 +171,4 @@ class Request: if __name__ == "__main__": import doctest - doctest.testmod()
\ No newline at end of file + doctest.testmod() diff --git a/module/thread_list.py b/module/thread_list.py index a7e92b77d..677fe7ecc 100644 --- a/module/thread_list.py +++ b/module/thread_list.py @@ -117,8 +117,8 @@ class Thread_List(object): data = data.replace(pyfile.url + '\n', "") - with open(self.parent.config['link_file'], 'w') as f: - f.write(data) + #with open(self.parent.config['link_file'], 'w') as f: + #f.write(data) if pyfile.status.type == "reconnected":#put it back in queque self.py_load_files.insert(0, pyfile) |