summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar spoob <spoob@gmx.de> 2009-06-18 15:05:25 +0200
committerGravatar spoob <spoob@gmx.de> 2009-06-18 15:05:25 +0200
commitb82662e8c9ac9ff0047f75a04f350dc880eb330f (patch)
tree037c5d1784a0321da92e75c3cfd3ee4f2957ea60
parentplugin for gigasize (diff)
downloadpyload-b82662e8c9ac9ff0047f75a04f350dc880eb330f.tar.xz
worked on gigasize.com Plugin
-rw-r--r--Plugins/GigasizeCom.py31
-rw-r--r--Plugins/RapidshareCom.py1
-rw-r--r--Plugins/ZshareNet.py1
-rw-r--r--module/download_thread.py2
-rw-r--r--module/file_list.py11
-rw-r--r--sockettest.py79
6 files changed, 30 insertions, 95 deletions
diff --git a/Plugins/GigasizeCom.py b/Plugins/GigasizeCom.py
index ef39cc3cc..bf8b3d97e 100644
--- a/Plugins/GigasizeCom.py
+++ b/Plugins/GigasizeCom.py
@@ -4,6 +4,7 @@
import os
import re
import tempfile
+from time import time
from Plugin import Plugin
@@ -30,14 +31,19 @@ class GigasizeCom(Plugin):
url = self.parent.url
self.html[0] = self.req.load(url, cookies=True)
- captcha_image = tempfile.NamedTemporaryFile().name + ".jpg"
- self.req.download("http://www.gigasize.com/randomImage.php", captcha_image, cookies=True)
- captcha = self.ocr.get_captcha(captcha_image)
+ captcha_image = tempfile.NamedTemporaryFile(suffix=".jpg").name
+
+ for i in range(0,5):
+ self.req.download("http://www.gigasize.com/randomImage.php", captcha_image, cookies=True)
+ captcha = self.ocr.get_captcha(captcha_image)
+ self.html[1] = self.req.load("http://www.gigasize.com/formdownload.php", None, {"txtNumber": captcha}, cookies=True)
+
+ if re.search(r"Package features", self.html[1]) != None:
+ if re.search(r"YOU HAVE REACHED YOUR HOURLY LIMIT", self.html[1]) != None:
+ self.time_plus_wait = time() + 3600 #one hour
+ break
os.remove(captcha_image)
- print captcha
-
- self.html[1] = self.req.load(file_server_url, None, {"txtNumber": captcha}, cookies=True)
def get_file_url(self):
""" returns the absolute downloadable filepath
@@ -45,8 +51,13 @@ class GigasizeCom(Plugin):
if self.html[0] == None:
self.download_html()
if not self.want_reconnect:
- file_url_pattern = r"<form action=\"(/getcgi.php\?t=.*)\" method=\"post\" id=\"formDownload\">"
- return "http://gigazise.com" + re.search(file_url_pattern, self.html[1]).group(1)
+ file_url_pattern = '<form action="(/getcgi.php\?t=.*)" method="post" id="formDownload">'
+ search = re.search(file_url_pattern, self.html[1])
+ print search
+ if search:
+ return "http://gigazise.com" + search.group(1)
+ return ""
+
else:
return False
@@ -64,11 +75,11 @@ class GigasizeCom(Plugin):
"""
if self.html[0] == None:
self.download_html()
- if re.search(r"HTTP Status 404", self.html) != None:
+ if re.search(r"The file has been deleted", self.html[0]) != None:
return False
else:
return True
def proceed(self, url, location):
- self.req.download(url, location, cookies=True) \ No newline at end of file
+ self.req.download(url, location, cookies=True)
diff --git a/Plugins/RapidshareCom.py b/Plugins/RapidshareCom.py
index 84f03b651..894deb4f7 100644
--- a/Plugins/RapidshareCom.py
+++ b/Plugins/RapidshareCom.py
@@ -2,7 +2,6 @@
# -*- coding: utf-8 -*-
import re
-import time
from time import time
from Plugin import Plugin
diff --git a/Plugins/ZshareNet.py b/Plugins/ZshareNet.py
index 33667605f..e81988454 100644
--- a/Plugins/ZshareNet.py
+++ b/Plugins/ZshareNet.py
@@ -34,6 +34,7 @@ class ZshareNet(Plugin):
url = url.replace("/audio/", "/download/")
elif "/image/" in url:
url = url.replace("/image/", "/download/")
+ print url
self.html[1] = self.req.load(url, None, {"download": "1"})
def get_file_url(self):
diff --git a/module/download_thread.py b/module/download_thread.py
index f68cfedd7..f8cad7846 100644
--- a/module/download_thread.py
+++ b/module/download_thread.py
@@ -90,6 +90,8 @@ class Download_Thread(threading.Thread):
status.want_reconnect = False
return False
sleep(1)
+ if status.filename == "":
+ pyfile.get_filename()
status.want_reconnect = False
diff --git a/module/file_list.py b/module/file_list.py
index 3a1c866dc..ea2dfd817 100644
--- a/module/file_list.py
+++ b/module/file_list.py
@@ -50,10 +50,12 @@ class File_List(object):
def remove(self, pyfile):
- if pyfile in self.files:
- self.files.remove(pyfile)
+ pass
- del self.data[pyfile.id]
+ #if pyfile in self.files:
+ # self.files.remove(pyfile)
+
+ #del self.data[pyfile.id]
def get_id(self):
"""return a free id"""
@@ -62,7 +64,6 @@ class File_List(object):
id += 1
return id
-
def save(self):
output = open('links.pkl', 'wb')
@@ -95,4 +96,4 @@ class File_List(object):
class Data():
def __init__(self, url):
- self.url = url \ No newline at end of file
+ self.url = url
diff --git a/sockettest.py b/sockettest.py
deleted file mode 100644
index ee0053b11..000000000
--- a/sockettest.py
+++ /dev/null
@@ -1,79 +0,0 @@
-#!/usr/bin/env python
-# -'- coding: utf-8 -*.
-"""
-authored by: RaNaN
-
-script only for socket testing
-
-"""
-import base64
-import hashlib
-import random
-import string
-import time
-
-import cPickle
-from Crypto.Cipher import Blowfish
-from module.remote.RequestObject import RequestObject
-from module.remote.ClientSocket import SocketThread
-
-class Handler:
- def __init__(self):
- key = hashlib.sha256("pwhere")
- print key.hexdigest()
- self.bf = Blowfish.new(key.hexdigest(), Blowfish.MODE_ECB)
-
- def proceed(self, data):
-
- return self.decrypt(self.encrypt(str(("lol", "mehrlol", "pff"))))
-
- def decrypt(self, dec_str):
- try:
- dec_str = base64.standard_b64decode(dec_str)
- dec_str = self.bf.decrypt(dec_str)
-
- dec_str = dec_str[:-(int(dec_str[-1], 16) + 1)]
- obj = cPickle.loads(dec_str)
- except:
- obj = None
- return obj
-
- def encrypt(self, obj):
- enc_str = cPickle.dumps(obj, 1)
- padding = len(enc_str) % 16
- padding = 16 - padding
-
- p_str = ""
- for i in range(padding - 1):
- p_str += random.choice(string.letters + string.digits)
- p_str += hex(len(p_str)).replace("0x", "")
- enc_str += p_str
-
- enc_str = self.bf.encrypt(enc_str)
- enc_str = base64.standard_b64encode(enc_str)
- return enc_str
-
-
-
-import socket
-
-handler = Handler()
-sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
-sock.connect(('localhost', 7272))
-th = SocketThread(sock)
-#th.socket.connect(('localhost', 7272))
-print "Connected to server"
-
-obj = RequestObject()
-obj.command = "exec"
-obj.function = "get_downloads"
-
-data = handler.encrypt(obj)
-print "going to push", data
-th.socket.push(data + "\n")
-#response = sock.recv(8192)
-
-#print "Received:", handler.decrypt(response).response
-#sock.close()
-while True:
- sleep(10000) \ No newline at end of file