summaryrefslogtreecommitdiffstats
path: root/module/plugins/hoster/WebshareCz.py
diff options
context:
space:
mode:
Diffstat (limited to 'module/plugins/hoster/WebshareCz.py')
-rw-r--r--module/plugins/hoster/WebshareCz.py50
1 files changed, 24 insertions, 26 deletions
diff --git a/module/plugins/hoster/WebshareCz.py b/module/plugins/hoster/WebshareCz.py
index ae670c8d4..0a89363f8 100644
--- a/module/plugins/hoster/WebshareCz.py
+++ b/module/plugins/hoster/WebshareCz.py
@@ -2,61 +2,59 @@
import re
-from module.network.RequestFactory import getURL
+from module.network.RequestFactory import getURL as get_url
from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
class WebshareCz(SimpleHoster):
__name__ = "WebshareCz"
__type__ = "hoster"
- __version__ = "0.16"
+ __version__ = "0.19"
+ __status__ = "testing"
- __pattern__ = r'https?://(?:www\.)?webshare\.cz/(?:#/)?file/(?P<ID>\w+)'
+ __pattern__ = r'https?://(?:www\.)?(en\.)?webshare\.cz/(?:#/)?file/(?P<ID>\w+)'
__config__ = [("use_premium", "bool", "Use premium account if available", True)]
__description__ = """WebShare.cz hoster plugin"""
__license__ = "GPLv3"
- __authors__ = [("stickell", "l.stickell@yahoo.it"),
- ("rush", "radek.senfeld@gmail.com")]
+ __authors__ = [("stickell", "l.stickell@yahoo.it "),
+ ("rush" , "radek.senfeld@gmail.com")]
@classmethod
- def getInfo(cls, url="", html=""):
- info = super(WebshareCz, cls).getInfo(url, html)
+ def api_info(cls, url):
+ info = super(WebshareCz, cls).api_info(url)
- if url:
- info['pattern'] = re.match(cls.__pattern__, url).groupdict()
+ info['pattern'] = re.match(cls.__pattern__, url).groupdict()
- api_data = getURL("https://webshare.cz/api/file_info/",
- post={'ident': info['pattern']['ID']},
- decode=True)
+ api_data = get_url("https://webshare.cz/api/file_info/",
+ post={'ident': info['pattern']['ID'], 'wst': ""})
- if 'File not found' in api_data:
- info['status'] = 1
- else:
- info["status"] = 2
- info['name'] = re.search('<name>(.+)</name>', api_data).group(1) or info['name']
- info['size'] = re.search('<size>(.+)</size>', api_data).group(1) or info['size']
+ if not re.search(r'<status>OK', api_data):
+ info['status'] = 1
+ else:
+ info['status'] = 2
+ info['name'] = re.search(r'<name>(.+?)<', api_data).group(1)
+ info['size'] = re.search(r'<size>(.+?)<', api_data).group(1)
return info
- def handleFree(self, pyfile):
- wst = self.account.infos['wst'] if self.account and 'wst' in self.account.infos else ""
+ def handle_free(self, pyfile):
+ wst = self.account.get_data(self.user).get('wst', None) if self.account else None
- api_data = getURL('https://webshare.cz/api/file_link/',
- post={'ident': self.info['pattern']['ID'], 'wst': wst},
- decode=True)
+ api_data = get_url("https://webshare.cz/api/file_link/",
+ post={'ident': self.info['pattern']['ID'], 'wst': wst})
- self.logDebug("API data: " + api_data)
+ self.log_debug("API data: " + api_data)
m = re.search('<link>(.+)</link>', api_data)
if m:
self.link = m.group(1)
- def handlePremium(self, pyfile):
- return self.handleFree(pyfile)
+ def handle_premium(self, pyfile):
+ return self.handle_free(pyfile)
getInfo = create_getInfo(WebshareCz)