# -*- coding: utf-8 -*-
import re
from module.plugins.internal.XFSPHoster import XFSPHoster, create_getInfo
class NosuploadCom(XFSPHoster):
__name__ = "NosuploadCom"
__type__ = "hoster"
__version__ = "0.3"
__pattern__ = r'http://(?:www\.)?nosupload\.com/\?d=\w{12}'
__description__ = """Nosupload.com hoster plugin"""
__authors__ = [("igel", "igelkun@myopera.com")]
HOSTER_NAME = "nosupload.com"
FILE_SIZE_PATTERN = r'
Size: (?P[0-9\.]+) (?P[kKMG]?B)
'
LINK_PATTERN = r'Download'
WAIT_PATTERN = r'Please wait.*?>(\d+)'
def getDownloadLink(self):
# stage1: press the "Free Download" button
data = self.getPostParameters()
self.html = self.load(self.pyfile.url, post=data, ref=True, decode=True)
# stage2: wait some time and press the "Download File" button
data = self.getPostParameters()
wait_time = re.search(self.WAIT_PATTERN, self.html, re.MULTILINE | re.DOTALL).group(1)
self.logDebug("Hoster told us to wait %s seconds" % wait_time)
self.wait(wait_time)
self.html = self.load(self.pyfile.url, post=data, ref=True, decode=True)
# stage3: get the download link
return re.search(self.LINK_PATTERN, self.html, re.S).group(1)
getInfo = create_getInfo(NosuploadCom)