# -*- 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: zoidberg
"""
import re
from module.plugins.internal.SimpleHoster import SimpleHoster, parseFileInfo
from module.network.RequestFactory import getURL
def getInfo(urls):
result = []
for url in urls:
file_info = parseFileInfo(DataportCz, url, getURL(url, decode=True))
result.append(file_info)
yield result
class DataportCz(SimpleHoster):
__name__ = "DataportCz"
__type__ = "hoster"
__pattern__ = r"http://.*dataport.cz/file/.*"
__version__ = "0.32"
__description__ = """Dataport.cz plugin - free only"""
__author_name__ = ("zoidberg")
FILE_NAME_PATTERN = r'
([^<]+)
'
FILE_SIZE_PATTERN = r'Velikost souboru: | \s*([0-9.]+)([kKMG]i?B) | '
URL_PATTERN = r']*class="ui-state-default button hover ui-corner-all ">'
NO_SLOTS_PATTERN = r']*class="ui-state-default button hover ui-corner-all ui-state-disabled">'
FILE_OFFLINE_PATTERN = r'Soubor nebyl nalezen'
def handleFree(self):
if re.search(self.NO_SLOTS_PATTERN, self.html):
self.setWait(900, True)
self.wait()
self.retry(12, 0, "No free slots")
found = re.search(self.URL_PATTERN, self.html)
if found is None:
self.fail("Parse error (URL)")
download_url = found.group(1)
self.download(download_url) | |