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

import re

from module.utils import html_unescape, parseFileSize

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

key = "bGhGMkllZXByd2VEZnU5Y2NXbHhYVlZ5cEE1bkEzRUw=".decode('base64')

def correctDownloadLink(url):
    url = re.sub("http://.*?/", "http://uploaded.to/",url, 1)
    url = re.sub("\\.to/.*?id=", ".to/file/", url, 1)

    if "/file/" not in url:
        url = url.replace("uploaded.to/", "uploaded.to/file/")

    parts = url.split("/")
    return "/".join(parts[:min(5,len(parts))]) + "/"

def getID(url):
    """ returns id of corrected url"""
    return re.search(r"uploaded.to/file/([^/]+)", url).group(1)

def getAPIData(urls):
        post = {"apikey" : key}

        idMap = {}

        for i, url in enumerate(urls):
            newUrl = correctDownloadLink(url)
            id = getID(newUrl)
            post["id_%s" % i] = id
            idMap[id] = url

        api = unicode(getURL("http://uploaded.to/api/filemultiple", post=post, decode=False), 'iso-8859-1')

        result = {}

        if api:
            for line in api.splitlines():
                data = line.split(",")
                if data[1] in idMap:
                    result[data[1]] = (data[0], data[2], data[4], data[3], idMap[data[1]])

        return result
<commit_msg>fixed a bug where filenames where cut at a comma<commit_after># -*- coding: utf-8 -*-

import re

from module.utils import html_unescape, parseFileSize

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

key = "bGhGMkllZXByd2VEZnU5Y2NXbHhYVlZ5cEE1bkEzRUw=".decode('base64')

def correctDownloadLink(url):
    url = re.sub("http://.*?/", "http://uploaded.to/",url, 1)
    url = re.sub("\\.to/.*?id=", ".to/file/", url, 1)

    if "/file/" not in url:
        url = url.replace("uploaded.to/", "uploaded.to/file/")

    parts = url.split("/")
    return "/".join(parts[:min(5,len(parts))]) + "/"

def getID(url):
    """ returns id of corrected url"""
    return re.search(r"uploaded.to/file/([^/]+)", url).group(1)

def getAPIData(urls):
        post = {"apikey" : key}

        idMap = {}

        for i, url in enumerate(urls):
            newUrl = correctDownloadLink(url)
            id = getID(newUrl)
            post["id_%s" % i] = id
            idMap[id] = url

        api = unicode(getURL("http://uploaded.to/api/filemultiple", post=post, decode=False), 'iso-8859-1')

        result = {}

        if api:
            for line in api.splitlines():
                data = line.split(",", 4)
                if data[1] in idMap:
                    result[data[1]] = (data[0], data[2], data[4], data[3], idMap[data[1]])

        return result

{'fraction_non_alphanumeric': 0.16883561643835615, 'fraction_numerical': 0.01678082191780822, 'mean_word_length': 2.5066026410564226, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5507508', 'n_tokens_mistral': 1046, 'n_tokens_neox': 1003, 'n_words': 224}