<commit_before>#!/usr/bin/env python
# -*- coding: utf-8 -*-

import re
from urllib import unquote
from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
from module.plugins.internal.CaptchaService import ReCaptcha


class DepositfilesCom(SimpleHoster):
    __name__ = "DepositfilesCom"
    __type__ = "hoster"
    __pattern__ = r"http://[\w\.]*?(depositfiles\.com|dfiles\.eu)(/\w{1,3})?/files/[\w]+"
    __version__ = "0.44"
    __description__ = """Depositfiles.com Download Hoster"""
    __author_name__ = ("spoob", "zoidberg")
    __author_mail__ = ("<EMAIL>", "<EMAIL>")

    FILE_NAME_PATTERN = r'File name: <b title="(?P<N>[^"]+)'
    FILE_SIZE_PATTERN = r'File size: <b>(?P<S>[0-9.]+)&nbsp;(?P<U>[kKMG])i?B</b>'
    FILE_INFO_PATTERN = r'<script type="text/javascript">eval\( unescape\(\'(?P<N>.*?)\''
    FILE_OFFLINE_PATTERN = r'<span class="html_download_api-not_exists"></span>'
    FILE_URL_REPLACEMENTS = [(r"\.com(/.*?)?/files", ".com/en/files"), (r"\.html$", "")]
    FILE_NAME_REPLACEMENTS = [(r'\%u([0-9A-Fa-f]{4})', lambda m: unichr(int(m.group(1), 16))),
                              (r'.*<b title="(?P<N>[^"]+).*', "\g<N>" )]

    RECAPTCHA_PATTERN = r"Recaptcha.create\('([^']+)'"
    DOWNLOAD_LINK_PATTERN = r'<form id="downloader_file_form" action="(http://.+?\.(dfiles\.eu|depositfiles\.com)/.+?)" method="post"'

    def setup(self):
        self.multiDL = False
        self.resumeDownload = self.premium

    def handleFree(self):
        self.html = self.load(self.pyfile.url, post={"gateway_result": "1"}, cookies=True)
        if re.search(self.FILE_OFFLINE_PATTERN, self.html):
            self.offline()

        if re.search(r'File is checked, please try again in a minute.', self.html) is not None:
            self.logInfo("DepositFiles.com: The file is being checked. Waiting 1 minute.")
            self.setWait(61)
            self.wait()
            self.retry()

        wait = re.search(r'html_download_api-limit_interval\">(\d+)</span>', self.html)
        if wait:
            wait_time = int(wait.group(1))
            self.logInfo("%s: Traffic used up. Waiting %d seconds." % (self.__name__, wait_time))<commit_msg>Depositfiles: fixed file size detect<commit_after>#!/usr/bin/env python
# -*- coding: utf-8 -*-

import re
from urllib import unquote
from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
from module.plugins.internal.CaptchaService import ReCaptcha


class DepositfilesCom(SimpleHoster):
    __name__ = "DepositfilesCom"
    __type__ = "hoster"
    __pattern__ = r"http://[\w\.]*?(depositfiles\.com|dfiles\.eu)(/\w{1,3})?/files/[\w]+"
    __version__ = "0.45"
    __description__ = """Depositfiles.com Download Hoster"""
    __author_name__ = ("spoob", "zoidberg")
    __author_mail__ = ("<EMAIL>", "<EMAIL>")

    FILE_SIZE_PATTERN = r': <b>(?P<S>[0-9.]+)&nbsp;(?P<U>[kKMG])i?B</b>'
    FILE_NAME_PATTERN = r'<script type="text/javascript">eval\( unescape\(\'(?P<N>.*?)\''
    FILE_OFFLINE_PATTERN = r'<span class="html_download_api-not_exists"></span>'
    FILE_URL_REPLACEMENTS = [(r"\.com(/.*?)?/files", ".com/en/files"), (r"\.html$", "")]
    FILE_NAME_REPLACEMENTS = [(r'\%u([0-9A-Fa-f]{4})', lambda m: unichr(int(m.group(1), 16))),
                              (r'.*<b title="(?P<N>[^"]+).*', "\g<N>" )]

    RECAPTCHA_PATTERN = r"Recaptcha.create\('([^']+)'"
    DOWNLOAD_LINK_PATTERN = r'<form id="downloader_file_form" action="(http://.+?\.(dfiles\.eu|depositfiles\.com)/.+?)" method="post"'

    def setup(self):
        self.multiDL = False
        self.resumeDownload = self.premium

    def handleFree(self):
        self.html = self.load(self.pyfile.url, post={"gateway_result": "1"}, cookies=True)
        if re.search(self.FILE_OFFLINE_PATTERN, self.html):
            self.offline()

        if re.search(r'File is checked, please try again in a minute.', self.html) is not None:
            self.logInfo("DepositFiles.com: The file is being checked. Waiting 1 minute.")
            self.setWait(61)
            self.wait()
            self.retry()

        wait = re.search(r'html_download_api-limit_interval\">(\d+)</span>', self.html)
        if wait:
            wait_time = int(wait.group(1))
            self.logInfo("%s: Traffic used up. Waiting %d seconds." % (self.__name__, wait_time))
{'fraction_non_alphanumeric': 0.19477214897062226, 'fraction_numerical': 0.008790191996298867, 'mean_word_length': 3.2642998027613412, 'pattern_counts': {'":': 2, '<': 35, '<?xml version=': 0, '>': 32, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 10, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2126090', 'n_tokens_mistral': 1636, 'n_tokens_neox': 1551, 'n_words': 265}