summaryrefslogtreecommitdiffstats
path: root/pyload/plugins/hoster/DebridItaliaCom.py
diff options
context:
space:
mode:
Diffstat (limited to 'pyload/plugins/hoster/DebridItaliaCom.py')
-rw-r--r--pyload/plugins/hoster/DebridItaliaCom.py37
1 files changed, 20 insertions, 17 deletions
diff --git a/pyload/plugins/hoster/DebridItaliaCom.py b/pyload/plugins/hoster/DebridItaliaCom.py
index 81cf0b830..a629b06a9 100644
--- a/pyload/plugins/hoster/DebridItaliaCom.py
+++ b/pyload/plugins/hoster/DebridItaliaCom.py
@@ -3,48 +3,51 @@
import re
from pyload.plugins.internal.Hoster import Hoster
+from pyload.plugins.internal.SimpleHoster import replace_patterns
class DebridItaliaCom(Hoster):
__name__ = "DebridItaliaCom"
__type__ = "hoster"
- __version__ = "0.05"
+ __version__ = "0.07"
- __pattern__ = r'https?://(?:[^/]*\.)?debriditalia\.com'
+ __pattern__ = r'http://s\d+\.debriditalia\.com/dl/\d+'
__description__ = """Debriditalia.com hoster plugin"""
__license__ = "GPLv3"
- __authors__ = [("stickell", "l.stickell@yahoo.it")]
+ __authors__ = [("stickell", "l.stickell@yahoo.it"),
+ ("Walter Purcaro", "vuolter@gmail.com")]
+
+
+ URL_REPLACEMENTS = [(r'(/dl/\d+)$', '\1/')]
def setup(self):
- self.chunkLimit = -1
+ self.chunkLimit = -1
self.resumeDownload = True
def process(self, pyfile):
+ pyfile.url = replace_patterns(pyfile.url, cls.URL_REPLACEMENTS)
+
if re.match(self.__pattern__, pyfile.url):
- new_url = pyfile.url
+ link = pyfile.url
+
elif not self.account:
self.logError(_("Please enter your %s account or deactivate this plugin") % "DebridItalia")
self.fail(_("No DebridItalia account provided"))
+
else:
- self.logDebug("Old URL: %s" % pyfile.url)
- url = "http://debriditalia.com/linkgen2.php?xjxfun=convertiLink&xjxargs[]=S<![CDATA[%s]]>" % pyfile.url
- page = self.load(url)
- self.logDebug("XML data: %s" % page)
+ html = self.load("http://www.debriditalia.com/api.php", get={'generate': "", 'link': pyfile.url})
- if 'File not available' in page:
- self.fail(_("File not available"))
- else:
- new_url = re.search(r'<a href="(?:[^"]+)">(?P<direct>[^<]+)</a>', page).group('direct')
+ if "ERROR" in html:
+ self.fail(re.search(r'ERROR:(.*)', html).strip())
- if new_url != pyfile.url:
- self.logDebug("New URL: %s" % new_url)
+ link = html.strip()
- self.download(new_url, disposition=True)
+ self.download(link, disposition=True)
- check = self.checkDownload({"empty": re.compile(r"^$")})
+ check = self.checkDownload({'empty': re.compile(r'^$')})
if check == "empty":
self.retry(5, 2 * 60, "Empty file downloaded")