# -*- 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 toInfoPage(url):
if r"/download.php?" in url:
try:
id = re.search(r"id=(\d+)", url).group(1)
code = re.search(r"code=(\w+)", url).group(1)
except Exception, e:
return None
return "http://czshare.com/%s/%s/" % (id, code)
return url
def getInfo(urls):
result = []
for url in urls:
info_url = toInfoPage(url)
if info_url:
file_info = parseFileInfo(CzshareCom, url, getURL(info_url, decode=True))
result.append(file_info)
yield result
class CzshareCom(SimpleHoster):
__name__ = "CzshareCom"
__type__ = "hoster"
__pattern__ = r"http://(\w*\.)*czshare\.(com|cz)/(\d+/|download.php\?).*"
__version__ = "0.86"
__description__ = """CZshare.com"""
__author_name__ = ("zoidberg")
FILE_NAME_PATTERN = r'
\s*
\s*Cel. n.zev: ]*>(?P[^<]+)'
FILE_SIZE_PATTERN = r'
(?:\s*
[^\n]*
)*\s*Velikost:\s*(?P
[0-9., ]+)(?P[kKMG])i?B\s*'
FILE_OFFLINE_PATTERN = r'