summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@gmail.com> 2014-07-06 18:57:55 +0200
committerGravatar Walter Purcaro <vuolter@gmail.com> 2014-07-06 18:57:55 +0200
commit0072668fd976f9ce4dbaac7e807791f21cbe07ed (patch)
tree473ef27784ac8f7f2001bdca159852cf3be74ec2
parent[UpdateManager] Little code cleanup + improved threading (diff)
downloadpyload-0072668fd976f9ce4dbaac7e807791f21cbe07ed.tar.xz
Compute wait time using secondsToMidnight
-rw-r--r--module/plugins/hoster/BitshareCom.py3
-rw-r--r--module/plugins/hoster/ExtabitCom.py11
-rw-r--r--module/plugins/hoster/FileserveCom.py13
-rw-r--r--module/plugins/hoster/FreakshareCom.py6
-rw-r--r--module/plugins/hoster/LetitbitNet.py15
-rw-r--r--module/plugins/hoster/RapidgatorNet.py14
-rw-r--r--module/plugins/hoster/SimplyPremiumCom.py22
-rw-r--r--module/plugins/hoster/SockshareCom.py11
-rw-r--r--module/plugins/hoster/UnrestrictLi.py11
9 files changed, 53 insertions, 53 deletions
diff --git a/module/plugins/hoster/BitshareCom.py b/module/plugins/hoster/BitshareCom.py
index 3b0fc5137..89546aae5 100644
--- a/module/plugins/hoster/BitshareCom.py
+++ b/module/plugins/hoster/BitshareCom.py
@@ -49,8 +49,7 @@ class BitshareCom(SimpleHoster):
# Check Traffic used up
if re.search(self.TRAFFIC_USED_UP, self.html):
- self.logInfo("Your Traffic is used up for today. Wait 1800 seconds or reconnect!")
- self.logDebug("Waiting %d seconds." % 1800)
+ self.logInfo("Your Traffic is used up for today")
self.wait(30 * 60, True)
self.retry()
diff --git a/module/plugins/hoster/ExtabitCom.py b/module/plugins/hoster/ExtabitCom.py
index 4396f08cb..c2b5098e9 100644
--- a/module/plugins/hoster/ExtabitCom.py
+++ b/module/plugins/hoster/ExtabitCom.py
@@ -13,22 +13,22 @@
You should have received a copy of the GNU General Public License
along with this program; if not, see <http://www.gnu.org/licenses/>.
-
- @author: zoidberg
"""
import re
+from module.common.json_layer import json_loads
+
+from module.plugins.hoster.UnrestrictLi import secondsToMidnight
from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
from module.plugins.internal.CaptchaService import ReCaptcha
-from module.common.json_layer import json_loads
class ExtabitCom(SimpleHoster):
__name__ = "ExtabitCom"
__type__ = "hoster"
__pattern__ = r'http://(?:www\.)?extabit\.com/(file|go|fid)/(?P<ID>\w+)'
- __version__ = "0.5"
+ __version__ = "0.6"
__description__ = """Extabit.com hoster plugin"""
__author_name__ = "zoidberg"
__author_mail__ = "zoidberg@mujmail.cz"
@@ -48,7 +48,8 @@ class ExtabitCom(SimpleHoster):
if m:
self.wait(int(m.group(1)) * 60, True)
elif "The daily downloads limit from your IP is exceeded" in self.html:
- self.wait(1 * 60 * 60, True)
+ self.logWarning("You have reached your daily downloads limit for today")
+ self.wait(secondsToMidnight(gmt=2), True)
self.logDebug("URL: " + self.req.http.lastEffectiveURL)
m = re.match(self.__pattern__, self.req.http.lastEffectiveURL)
diff --git a/module/plugins/hoster/FileserveCom.py b/module/plugins/hoster/FileserveCom.py
index 4c678c1b1..f6e102f08 100644
--- a/module/plugins/hoster/FileserveCom.py
+++ b/module/plugins/hoster/FileserveCom.py
@@ -16,12 +16,15 @@
"""
import re
-from module.plugins.Hoster import Hoster
+
from module.network.RequestFactory import getURL
-from module.plugins.internal.CaptchaService import ReCaptcha
from module.common.json_layer import json_loads
+from module.plugins.internal.CaptchaService import ReCaptcha
from module.utils import parseFileSize
+
+from module.plugins.Hoster import Hoster
from module.plugins.Plugin import chunks
+from module.plugins.hoster.UnrestrictLi import secondsToMidnight
def checkFile(plugin, urls):
@@ -47,7 +50,7 @@ class FileserveCom(Hoster):
__name__ = "FileserveCom"
__type__ = "hoster"
__pattern__ = r'http://(?:www\.)?fileserve\.com/file/(?P<id>[^/]+).*'
- __version__ = "0.51"
+ __version__ = "0.52"
__description__ = """Fileserve.com hoster plugin"""
__author_name__ = ("jeix", "mkaay", "Paul King", "zoidberg")
__author_mail__ = ("jeix@hasnomail.de", "mkaay@mkaay.de", "", "zoidberg@mujmail.cz")
@@ -133,8 +136,8 @@ class FileserveCom(Hoster):
elif check == "wait":
self.doLongWait(self.lastCheck)
elif check == "limit":
- #download limited reached for today (not a exact time known)
- self.setWait(3 * 60 * 60, True) # wait 3 hours #TO-DO: resolve waittime using UnrestrictLi's secondsToMidnight
+ self.logWarning("Download limited reached for today")
+ self.setWait(secondsToMidnight(gmt=2), True)
self.wait()
self.retry()
diff --git a/module/plugins/hoster/FreakshareCom.py b/module/plugins/hoster/FreakshareCom.py
index ad9abeb96..5b043d53d 100644
--- a/module/plugins/hoster/FreakshareCom.py
+++ b/module/plugins/hoster/FreakshareCom.py
@@ -1,7 +1,9 @@
# -*- coding: utf-8 -*-
import re
+
from module.plugins.Hoster import Hoster
+from module.plugins.hoster.UnrestrictLi import secondsToMidnight
from module.plugins.internal.CaptchaService import ReCaptcha
@@ -9,7 +11,7 @@ class FreakshareCom(Hoster):
__name__ = "FreakshareCom"
__type__ = "hoster"
__pattern__ = r'http://(?:www\.)?freakshare\.(net|com)/files/\S*?/'
- __version__ = "0.38"
+ __version__ = "0.39"
__description__ = """Freakshare.com hoster plugin"""
__author_name__ = ("sitacuisses", "spoob", "mkaay", "Toilal")
__author_mail__ = ("sitacuisses@yahoo.de", "spoob@pyload.org", "mkaay@mkaay.de", "toilal.dev@gmail.com")
@@ -122,7 +124,7 @@ class FreakshareCom(Hoster):
if "Your Traffic is used up for today" in self.html:
self.wantReconnect = True
- return 24 * 60 * 60
+ return secondsToMidnight(gmt=2)
timestring = re.search('\s*var\s(?:downloadWait|time)\s=\s(\d*)[.\d]*;', self.html)
if timestring:
diff --git a/module/plugins/hoster/LetitbitNet.py b/module/plugins/hoster/LetitbitNet.py
index 58532fd28..62743d468 100644
--- a/module/plugins/hoster/LetitbitNet.py
+++ b/module/plugins/hoster/LetitbitNet.py
@@ -13,22 +13,21 @@
You should have received a copy of the GNU General Public License
along with this program; if not, see <http://www.gnu.org/licenses/>.
-
- @author: zoidberg
"""
# API Documentation:
# http://api.letitbit.net/reg/static/api.pdf
-
# Test links (random.bin):
# http://letitbit.net/download/07874.0b5709a7d3beee2408bb1f2eefce/random.bin.html
import re
import urllib
-from module.plugins.internal.SimpleHoster import SimpleHoster
from module.common.json_layer import json_loads, json_dumps
+
+from module.plugins.hoster.UnrestrictLi import secondsToMidnight
from module.plugins.internal.CaptchaService import ReCaptcha
+from module.plugins.internal.SimpleHoster import SimpleHoster
def api_download_info(url):
@@ -52,7 +51,7 @@ class LetitbitNet(SimpleHoster):
__name__ = "LetitbitNet"
__type__ = "hoster"
__pattern__ = r'http://(?:www\.)?(letitbit|shareflare).net/download/.*'
- __version__ = "0.23"
+ __version__ = "0.24"
__description__ = """Letitbit.net hoster plugin"""
__author_name__ = ("zoidberg", "z00nx")
__author_mail__ = ("zoidberg@mujmail.cz", "z00nx0@gmail.com")
@@ -126,10 +125,10 @@ class LetitbitNet(SimpleHoster):
if not response:
self.invalidCaptcha()
if response == "error_free_download_blocked":
- self.logInfo("Daily limit reached, waiting 24 hours")
- self.wait(24 * 60 * 60)
+ self.logWarning("Daily limit reached")
+ self.wait(secondsToMidnight(gmt=2), True)
if response == "error_wrong_captcha":
- self.logInfo("Wrong Captcha")
+ self.logError("Wrong Captcha")
self.invalidCaptcha()
self.retry()
elif response.startswith('['):
diff --git a/module/plugins/hoster/RapidgatorNet.py b/module/plugins/hoster/RapidgatorNet.py
index 11950318b..d3399722e 100644
--- a/module/plugins/hoster/RapidgatorNet.py
+++ b/module/plugins/hoster/RapidgatorNet.py
@@ -17,10 +17,13 @@
###############################################################################
import re
+
from pycurl import HTTPHEADER
from module.common.json_layer import json_loads
from module.network.HTTPRequest import BadHeader
+
+from module.plugins.hoster.UnrestrictLi import secondsToMidnight
from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
from module.plugins.internal.CaptchaService import ReCaptcha, SolveMedia, AdsCaptcha
@@ -29,7 +32,7 @@ class RapidgatorNet(SimpleHoster):
__name__ = "RapidgatorNet"
__type__ = "hoster"
__pattern__ = r'http://(?:www\.)?(rapidgator\.net|rg\.to)/file/\w+'
- __version__ = "0.21"
+ __version__ = "0.22"
__description__ = """Rapidgator.net hoster plugin"""
__author_name__ = ("zoidberg", "chrox", "stickell", "Walter Purcaro")
__author_mail__ = ("zoidberg@mujmail.cz", "", "l.stickell@yahoo.it", "vuolter@gmail.com")
@@ -182,12 +185,13 @@ class RapidgatorNet(SimpleHoster):
if not found:
return
elif found.group(1) == "daily":
- wait_time = 60
+ self.logWarning("You have reached your daily downloads limit for today")
+ wait_time = secondsToMidnight(gmt=2)
else:
- wait_time = 24 * 60
+ wait_time = 1 * 60 * 60
- self.logDebug("Waiting %d minutes" % wait_time)
- self.wait(wait_time * 60, True)
+ self.logDebug("Waiting %d minutes" % wait_time / 60)
+ self.wait(wait_time, True)
self.retry()
def getJsonResponse(self, url):
diff --git a/module/plugins/hoster/SimplyPremiumCom.py b/module/plugins/hoster/SimplyPremiumCom.py
index 17060e00d..dcd97d1e3 100644
--- a/module/plugins/hoster/SimplyPremiumCom.py
+++ b/module/plugins/hoster/SimplyPremiumCom.py
@@ -19,22 +19,12 @@ import re
from datetime import datetime, timedelta
from module.plugins.Hoster import Hoster
-
-
-def secondsToMidnight():
- # Seconds until 00:10 GMT+2
- now = datetime.utcnow() + timedelta(hours=2)
- if now.hour is 0 and now.minute < 10:
- midnight = now
- else:
- midnight = now + timedelta(days=1)
- midnight = midnight.replace(hour=0, minute=10, second=0, microsecond=0)
- return int((midnight - now).total_seconds())
+from module.plugins.hoster.UnrestrictLi import secondsToMidnight
class SimplyPremiumCom(Hoster):
__name__ = "SimplyPremiumCom"
- __version__ = "0.02"
+ __version__ = "0.03"
__type__ = "hoster"
__pattern__ = r"https?://.*(simply-premium)\.com"
__description__ = """Simply-Premium.Com hoster plugin"""
@@ -69,13 +59,13 @@ class SimplyPremiumCom(Hoster):
elif "NOTFOUND" in page:
self.offline()
elif "downloadlimit" in page:
- self.logInfo("Reached maximum connctions")
+ self.logWarning("Reached maximum connctions")
self.retry(5, 60, "Reached maximum connctions")
elif "trafficlimit" in page:
- self.logInfo("Reached daily limit for this host. Waiting until 00:10 GMT+2")
- self.retry(5, secondsToMidnight(), "Daily limit for this host reached")
+ self.logWarning("Reached daily limit for this host")
+ self.retry(1, secondsToMidnight(gmt=2), "Daily limit for this host reached")
elif "hostererror" in page:
- self.logInfo("Hoster temporarily unavailable, waiting 1 minute and retry")
+ self.logWarning("Hoster temporarily unavailable, waiting 1 minute and retry")
self.retry(5, 60, "Hoster is temporarily unavailable")
#page = json_loads(page)
#new_url = page.keys()[0]
diff --git a/module/plugins/hoster/SockshareCom.py b/module/plugins/hoster/SockshareCom.py
index 60fd6a4cd..241089ee7 100644
--- a/module/plugins/hoster/SockshareCom.py
+++ b/module/plugins/hoster/SockshareCom.py
@@ -19,6 +19,7 @@
import re
from os import rename
+from module.plugins.hoster.UnrestrictLi import secondsToMidnight
from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
@@ -26,7 +27,7 @@ class SockshareCom(SimpleHoster):
__name__ = "SockshareCom"
__type__ = "hoster"
__pattern__ = r'http://(?:www\.)?sockshare\.com/(mobile/)?(file|embed)/(?P<ID>\w+)'
- __version__ = "0.02"
+ __version__ = "0.03"
__description__ = """Sockshare.com hoster plugin"""
__author_name__ = ("jeix", "stickell", "Walter Purcaro")
__author_mail__ = ("jeix@hasnomail.de", "l.stickell@yahoo.it", "vuolter@gmail.com")
@@ -54,9 +55,11 @@ class SockshareCom(SimpleHoster):
post_data = {"hash": hash_data.group(1), "confirm": "Continue+as+Free+User"}
self.html = self.load(self.pyfile.url, post=post_data)
- if (">You have exceeded the daily stream limit for your country\\. You can wait until tomorrow" in self.html or
- "(>This content server has been temporarily disabled for upgrades|Try again soon\\. You can still download it below\\.<)" in self.html):
- self.retry(wait_time=60 * 60 * 2, reason="Download limit exceeded or server disabled") # 2 hours wait
+ if ">You have exceeded the daily stream limit for your country\\. You can wait until tomorrow" in self.html:
+ self.logWarning("You have exceeded your daily stream limit for today")
+ self.wait(secondsToMidnight(gmt=2), True)
+ elif "(>This content server has been temporarily disabled for upgrades|Try again soon\\. You can still download it below\\.<)" in self.html):
+ self.retry(wait_time=2 * 60 * 60, reason="Server temporarily offline") # 2 hours wait
patterns = (r'(/get_file\.php\?id=[A-Z0-9]+&key=[a-zA-Z0-9=]+&original=1)',
r'(/get_file\.php\?download=[A-Z0-9]+&key=[a-z0-9]+)',
diff --git a/module/plugins/hoster/UnrestrictLi.py b/module/plugins/hoster/UnrestrictLi.py
index a0447d873..7558dfcf6 100644
--- a/module/plugins/hoster/UnrestrictLi.py
+++ b/module/plugins/hoster/UnrestrictLi.py
@@ -21,9 +21,8 @@ from module.plugins.Hoster import Hoster
from module.common.json_layer import json_loads
-def secondsToMidnight():
- # Seconds until 00:10 GMT+2
- now = datetime.utcnow() + timedelta(hours=2)
+def secondsToMidnight(gmt=0):
+ now = datetime.utcnow() + timedelta(hours=gmt)
if now.hour is 0 and now.minute < 10:
midnight = now
else:
@@ -34,7 +33,7 @@ def secondsToMidnight():
class UnrestrictLi(Hoster):
__name__ = "UnrestrictLi"
- __version__ = "0.11"
+ __version__ = "0.12"
__type__ = "hoster"
__pattern__ = r'https?://(?:[^/]*\.)?(unrestrict|unr)\.li'
__description__ = """Unrestrict.li hoster plugin"""
@@ -72,8 +71,8 @@ class UnrestrictLi(Hoster):
elif "You are not allowed to download from this host" in page:
self.fail("You are not allowed to download from this host")
elif "You have reached your daily limit for this host" in page:
- self.logInfo("Reached daily limit for this host. Waiting until 00:10 GMT+2")
- self.retry(5, secondsToMidnight(), "Daily limit for this host reached")
+ self.logWarning("Reached daily limit for this host")
+ self.retry(5, secondsToMidnight(gmt=2), "Daily limit for this host reached")
elif "ERROR_HOSTER_TEMPORARILY_UNAVAILABLE" in page:
self.logInfo("Hoster temporarily unavailable, waiting 1 minute and retry")
self.retry(5, 60, "Hoster is temporarily unavailable")