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

import re
from module.plugins.Hoster import Hoster
from module.network.RequestFactory import getURL
from module.plugins.Plugin import chunks

def getInfo(urls):
    result = []
    for chunk in chunks(urls, 10):
        for url in chunk:
            src = getURL(url)
            if r'<div class="errorMessage mb10">' in src:
                result.append((url, 0, 1, url))
            elif r'Page cannot be displayed' in src:
                result.append((url, 0, 1, url))
            else:
                try:
                    url_pattern = '<a href="(.+?)" onclick="return Act\(this\, \'dlink\'\, event\)">(.+?)</a>'
                    file_name = re.search(url_pattern, src).group(0).split(', event)">')[1].split('</a>')[0]
                    result.append((file_name, 0, 2, url))
                except:
                    pass


        # status 1=OFFLINE, 2=OK, 3=UNKNOWN
        # result.append((#name,#size,#status,#url))
        yield result

class FilesMailRu(Hoster):
    __name__ = "FilesMailRu"
    __type__ = "hoster"
    __pattern__ = r"http://files\.mail\.ru/.*"
    __version__ = "0.2"
    __description__ = """Files.Mail.Ru One-Klick Hoster"""
    __author_name__ = ("oZiRiz")
    __author_mail__ = ("<EMAIL>")

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

    def process(self, pyfile):
        self.html = self.load(pyfile.url)
        self.url_pattern = '<a href="(.+?)" onclick="return Act\(this\, \'dlink\'\, event\)">(.+?)</a>'
        
        #marks the file as "offline" when the pattern was found on the html-page'''
        if r'<div class="errorMessage mb10">' in self.html:
            self.offline()
        
        elif r'Page cannot be displayed' in self.html:
            self.offline()<commit_msg>disabled chunk dl for filesMail.ru (server doesnt seem to support it anymore)<commit_after>#!/usr/bin/env python
# -*- coding: utf-8 -*-

import re
from module.plugins.Hoster import Hoster
from module.network.RequestFactory import getURL
from module.plugins.Plugin import chunks

def getInfo(urls):
    result = []
    for chunk in chunks(urls, 10):
        for url in chunk:
            src = getURL(url)
            if r'<div class="errorMessage mb10">' in src:
                result.append((url, 0, 1, url))
            elif r'Page cannot be displayed' in src:
                result.append((url, 0, 1, url))
            else:
                try:
                    url_pattern = '<a href="(.+?)" onclick="return Act\(this\, \'dlink\'\, event\)">(.+?)</a>'
                    file_name = re.search(url_pattern, src).group(0).split(', event)">')[1].split('</a>')[0]
                    result.append((file_name, 0, 2, url))
                except:
                    pass


        # status 1=OFFLINE, 2=OK, 3=UNKNOWN
        # result.append((#name,#size,#status,#url))
        yield result

class FilesMailRu(Hoster):
    __name__ = "FilesMailRu"
    __type__ = "hoster"
    __pattern__ = r"http://files\.mail\.ru/.*"
    __version__ = "0.2"
    __description__ = """Files.Mail.Ru One-Klick Hoster"""
    __author_name__ = ("oZiRiz")
    __author_mail__ = ("<EMAIL>")

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

    def process(self, pyfile):
        self.html = self.load(pyfile.url)
        self.url_pattern = '<a href="(.+?)" onclick="return Act\(this\, \'dlink\'\, event\)">(.+?)</a>'
        
        #marks the file as "offline" when the pattern was found on the html-page'''
        if r'<div class="errorMessage mb10">' in self.html:
            self.offline()
        
        elif r'Page cannot be displayed' in self.html:
            self.offline()
{'fraction_non_alphanumeric': 0.1523161476053389, 'fraction_numerical': 0.011515310128238681, 'mean_word_length': 2.0625, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '4806467', 'n_tokens_mistral': 1262, 'n_tokens_neox': 1178, 'n_words': 304}