<commit_before># -*- coding: utf-8 -*-
#


import re

from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo


class HostujeNet(SimpleHoster):
    __name__    = "HostujeNet"
    __type__    = "hoster"
    __version__ = "0.01"

    __pattern__ = r'http://(?:www\.)?hostuje\.net/\w+'

    __description__ = """Hostuje.net hoster plugin"""
    __license__     = "GPLv3"
    __authors__     = [("GammaC0de", None)]


    NAME_PATTERN = r'<input type="hidden" name="name" value="(?P<N>.+?)">'
    SIZE_PATTERN = r'<b>Rozmiar:</b> (?P<S>[\d.,]+) (?P<U>[\w^_]+)<br>'
    OFFLINE_PATTERN = ur'Podany plik nie został odnaleziony\.\.\.'


    def setup(self):
        self.multiDL = True
        self.chunkLimit = 1


    def handleFree(self, pyfile):
        m = re.search(r'<script src="([\w^_]+.php)"></script>', self.html)
        if m:
            jscript = self.load("http://hostuje.net/" + m.group(1))
            m = re.search(r"\('(\w+\.php\?i=\w+)'\);", jscript)
            if m:
                self.load("http://hostuje.net/" + m.group(1))
            else:
                self.error(_("unexpected javascript format"))
        else:
            self.error(_("script not found"))

        action, inputs = self.parseHtmlForm(pyfile.url.replace(".", "\.").replace( "?", "\?"))
        if not action:
            self.error(_("form not found"))

        self.download(action, post=inputs)


getInfo = create_getInfo(HostujeNet)<commit_msg>[HostujeNet] Tiny cleanup<commit_after># -*- coding: utf-8 -*-

import re

from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo


class HostujeNet(SimpleHoster):
    __name__    = "HostujeNet"
    __type__    = "hoster"
    __version__ = "0.01"

    __pattern__ = r'http://(?:www\.)?hostuje\.net/\w+'

    __description__ = """Hostuje.net hoster plugin"""
    __license__     = "GPLv3"
    __authors__     = [("GammaC0de", None)]


    NAME_PATTERN    = r'<input type="hidden" name="name" value="(?P<N>.+?)">'
    SIZE_PATTERN    = r'<b>Rozmiar:</b> (?P<S>[\d.,]+) (?P<U>[\w^_]+)<br>'
    OFFLINE_PATTERN = ur'Podany plik nie został odnaleziony\.\.\.'


    def setup(self):
        self.multiDL    = True
        self.chunkLimit = 1


    def handleFree(self, pyfile):
        m = re.search(r'<script src="([\w^_]+.php)"></script>', self.html)
        if m:
            jscript = self.load("http://hostuje.net/" + m.group(1))
            m = re.search(r"\('(\w+\.php\?i=\w+)'\);", jscript)
            if m:
                self.load("http://hostuje.net/" + m.group(1))
            else:
                self.error(_("unexpected javascript format"))
        else:
            self.error(_("script not found"))

        action, inputs = self.parseHtmlForm(pyfile.url.replace(".", "\.").replace( "?", "\?"))
        if not action:
            self.error(_("form not found"))

        self.download(action, post=inputs)


getInfo = create_getInfo(HostujeNet)
{'fraction_non_alphanumeric': 0.19123641304347827, 'fraction_numerical': 0.006114130434782609, 'mean_word_length': 2.392857142857143, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5813193', 'n_tokens_mistral': 1072, 'n_tokens_neox': 1015, 'n_words': 183}