From b8df779fd5e18a56ac4871d51f52dab06139796e Mon Sep 17 00:00:00 2001
From: Christopher <4Christopher@gmx.de>
Date: Wed, 27 Feb 2013 00:18:30 +0100
Subject: added hoster/XvidstageCom.py
---
module/plugins/hoster/XvidstageCom.py | 105 ++++++++++++++++++++++++++++++++++
1 file changed, 105 insertions(+)
create mode 100644 module/plugins/hoster/XvidstageCom.py
(limited to 'module/plugins/hoster/XvidstageCom.py')
diff --git a/module/plugins/hoster/XvidstageCom.py b/module/plugins/hoster/XvidstageCom.py
new file mode 100644
index 000000000..1994e40ed
--- /dev/null
+++ b/module/plugins/hoster/XvidstageCom.py
@@ -0,0 +1,105 @@
+# -*- coding: utf-8 -*-
+
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see .
+
+ @author: 4Christopher
+"""
+
+from module.plugins.Hoster import Hoster
+from module.network.RequestFactory import getURL
+import re
+import HTMLParser
+
+def setup(self):
+ self.wantReconnect = False
+ self.resumeDownload = True
+ self.multiDL = True
+
+def getInfo(urls):
+ result = []
+
+ for url in urls:
+ result.append(parseFileInfo(url, getInfoMode = True))
+ yield result
+
+def parseFileInfo(url, getInfoMode = False):
+ html = getURL(url)
+ info = {"name" : url, "size" : 0, "status" : 3}
+ info['name'] = re.search(r'Filename:
(.*?)<', html).group(1)
+ info['size'] = re.search(r'Size: .*? \((\d+?) bytes\)', html).group(1)
+ if info['size'] == 0:
+ info['status'] = 1
+ else:
+ info['status'] = 2
+
+ if getInfoMode:
+ return info['name'], info['size'], info['status'], url
+ else:
+ return info['name'], info['size'], info['status'], html
+
+
+class XvidstageCom(Hoster):
+ __name__ = 'XvidstageCom'
+ __version__ = '0.1.1'
+ __pattern__ = r'http://(?:www.)?xvidstage.com/(?P[0-9A-Za-z]+)'
+ __type__ = 'hoster'
+ __description__ = """A Plugin that allows you to download files from http://xvidstage.com"""
+ __author_name__ = ('4Christopher')
+ __author_mail__ = ('4Christopher@gmx.de')
+
+
+ def process(self, pyfile):
+ pyfile.name, pyfile.size, pyfile.status, self.html = parseFileInfo(pyfile.url)
+ self.logDebug('Name: %s' % pyfile.name)
+ if pyfile.status == 1: ## offline
+ self.fail()
+ self.id = re.search(self.__pattern__, pyfile.url).group('id')
+
+ wait_sec = int(re.search(r'countdown_str">.+?>(\d+?)<', self.html).group(1))
+ self.setWait(wait_sec, reconnect=False)
+ self.logDebug('Waiting %d seconds before submitting the captcha' % wait_sec)
+ self.wait()
+
+ rand = re.search(r' ', self.html).group(1)
+ self.logDebug('rand: %s, id: %s' % (rand, self.id))
+ self.html = self.req.load(pyfile.url, post={'op': 'download2', 'id' : self.id, 'rand' : rand, 'code': self.get_captcha()})
+ file_url = re.search(r'(?P=url) ', self.html).group('url')
+ try:
+ hours_file_available = int(re.search(r'This direct link will be available for your IP next (?P\d+?) hours', self.html).group('hours'))
+ self.logDebug('You have %d hours to download this file with your current IP address.' % hours_file_available)
+ except:
+ self.logDebug('Failed')
+ self.logDebug('Download file: %s' % file_url)
+ self.download(file_url)
+ check = self.checkDownload({'empty': re.compile(r'^$')})
+
+ if check == 'empty':
+ self.logInfo('Downloaded File was empty')
+ # self.retry()
+
+ def get_captcha(self):
+ ## 1 …
+ cap_chars = {}
+ for pad_left, char in re.findall(r"position:absolute;padding-left:(\d+?)px;.*?;'>(.*?)<", self.html):
+ cap_chars[int(pad_left)] = char
+
+ h = HTMLParser.HTMLParser()
+ ## Sorting after padding-left
+ captcha = ''
+ for pad_left in sorted(cap_chars):
+ captcha += h.unescape(cap_chars[pad_left])
+
+ self.logDebug('The captcha is: %s' % captcha)
+ return captcha
--
cgit v1.2.3
From 7b1889af3caf854a2b4aaed32d27816402a8ef97 Mon Sep 17 00:00:00 2001
From: Christopher <4Christopher@gmx.de>
Date: Wed, 27 Feb 2013 13:21:13 +0100
Subject: little fixes
---
module/plugins/hoster/XvidstageCom.py | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
(limited to 'module/plugins/hoster/XvidstageCom.py')
diff --git a/module/plugins/hoster/XvidstageCom.py b/module/plugins/hoster/XvidstageCom.py
index 1994e40ed..38c54efec 100644
--- a/module/plugins/hoster/XvidstageCom.py
+++ b/module/plugins/hoster/XvidstageCom.py
@@ -37,8 +37,8 @@ def getInfo(urls):
def parseFileInfo(url, getInfoMode = False):
html = getURL(url)
info = {"name" : url, "size" : 0, "status" : 3}
- info['name'] = re.search(r'Filename: (.*?)<', html).group(1)
- info['size'] = re.search(r'Size: .*? \((\d+?) bytes\)', html).group(1)
+ info['name'] = re.search(r'(?:Filename|Dateiname): ]*?>(.*?)<', html).group(1)
+ info['size'] = re.search(r'(?:Size|Größe): .*? \((\d+?) bytes\)', html).group(1)
if info['size'] == 0:
info['status'] = 1
else:
@@ -49,10 +49,9 @@ def parseFileInfo(url, getInfoMode = False):
else:
return info['name'], info['size'], info['status'], html
-
class XvidstageCom(Hoster):
__name__ = 'XvidstageCom'
- __version__ = '0.1.1'
+ __version__ = '0.2'
__pattern__ = r'http://(?:www.)?xvidstage.com/(?P[0-9A-Za-z]+)'
__type__ = 'hoster'
__description__ = """A Plugin that allows you to download files from http://xvidstage.com"""
--
cgit v1.2.3
From 033130a4b8ed995c6b3d4a18e4aa25129f8758da Mon Sep 17 00:00:00 2001
From: Christopher <4Christopher@gmx.de>
Date: Tue, 12 Mar 2013 19:25:27 +0100
Subject: XvidstageCom: Deleted whitespace
---
module/plugins/hoster/XvidstageCom.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
(limited to 'module/plugins/hoster/XvidstageCom.py')
diff --git a/module/plugins/hoster/XvidstageCom.py b/module/plugins/hoster/XvidstageCom.py
index 38c54efec..6f3559d17 100644
--- a/module/plugins/hoster/XvidstageCom.py
+++ b/module/plugins/hoster/XvidstageCom.py
@@ -13,7 +13,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, see .
-
+
@author: 4Christopher
"""
@@ -29,7 +29,7 @@ def setup(self):
def getInfo(urls):
result = []
-
+
for url in urls:
result.append(parseFileInfo(url, getInfoMode = True))
yield result
--
cgit v1.2.3
From b3118afc4b8b03a8c248529757c9558610075a33 Mon Sep 17 00:00:00 2001
From: Christopher <4Christopher@gmx.de>
Date: Wed, 13 Mar 2013 16:49:42 +0100
Subject: XvidstageCom: I can now recognize if a file is offline
---
module/plugins/hoster/XvidstageCom.py | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
(limited to 'module/plugins/hoster/XvidstageCom.py')
diff --git a/module/plugins/hoster/XvidstageCom.py b/module/plugins/hoster/XvidstageCom.py
index 6f3559d17..14079df43 100644
--- a/module/plugins/hoster/XvidstageCom.py
+++ b/module/plugins/hoster/XvidstageCom.py
@@ -37,9 +37,10 @@ def getInfo(urls):
def parseFileInfo(url, getInfoMode = False):
html = getURL(url)
info = {"name" : url, "size" : 0, "status" : 3}
- info['name'] = re.search(r'(?:Filename|Dateiname): ]*?>(.*?)<', html).group(1)
- info['size'] = re.search(r'(?:Size|Größe): .*? \((\d+?) bytes\)', html).group(1)
- if info['size'] == 0:
+ try:
+ info['name'] = re.search(r'(?:Filename|Dateiname): ]*?>(.*?)<', html).group(1)
+ info['size'] = re.search(r'(?:Size|Größe): .*? \((\d+?) bytes\)', html).group(1)
+ except: ## The file is offline
info['status'] = 1
else:
info['status'] = 2
@@ -51,7 +52,7 @@ def parseFileInfo(url, getInfoMode = False):
class XvidstageCom(Hoster):
__name__ = 'XvidstageCom'
- __version__ = '0.2'
+ __version__ = '0.3'
__pattern__ = r'http://(?:www.)?xvidstage.com/(?P[0-9A-Za-z]+)'
__type__ = 'hoster'
__description__ = """A Plugin that allows you to download files from http://xvidstage.com"""
--
cgit v1.2.3