<commit_before>import xml.dom.minidom as dom

from pyload.plugins.MultiHoster import MultiHoster


class RealdebridCom(MultiHoster):
    __name__ = "RealdebridCom"
    __version__ = "0.5"
    __type__ = "account"
    __description__ = """Real-Debrid.com account plugin"""
    __author_name__ = ("<NAME>")
    __author_mail__ = ("<EMAIL>")

    def loadAccountInfo(self, req):
        page = req.load("http://real-debrid.com/api/account.php")
        xml = dom.parseString(page)
        account_info = {"validuntil": int(xml.getElementsByTagName("expiration")[0].childNodes[0].nodeValue),
                        "trafficleft": -1}

        return account_info

    def login(self, user, data, req):
        page = req.load("https://real-debrid.com/ajax/login.php", get={"user": user, "pass": data["password"]})
        # page = req.load("https://real-debrid.com/login.html",
        #                 post={"user": user, "pass": data["password"]}, cookies=True)

        if "Your login informations are incorrect" in page:
            self.wrongPassword()

    def loadHosterList(self, req):<commit_msg>Realdebrid: fixed #208<commit_after>import xml.dom.minidom as dom

from pyload.plugins.MultiHoster import MultiHoster


class RealdebridCom(MultiHoster):
    __name__ = "RealdebridCom"
    __version__ = "0.5"
    __type__ = "account"
    __description__ = """Real-Debrid.com account plugin"""
    __author_name__ = ("<NAME>")
    __author_mail__ = ("<EMAIL>")

    def loadAccountInfo(self, req):
        if self.pin_code:
            return {"premium": False}
        page = req.load("http://real-debrid.com/api/account.php")
        xml = dom.parseString(page)
        account_info = {"validuntil": int(xml.getElementsByTagName("expiration")[0].childNodes[0].nodeValue),
                        "trafficleft": -1}

        return account_info

    def login(self, user, data, req):
        self.pin_code = False
        page = req.load("https://real-debrid.com/ajax/login.php", get={"user": user, "pass": data["password"]})
        if "Your login informations are incorrect" in page:
            self.wrongPassword()
        elif "PIN Code required" in page:
            self.logWarning('PIN code required. Please login to https://real-debrid.com using the PIN or disable the double authentication in your control panel on https://real-debrid.com.')
            self.pin_code = True

    def loadHosterList(self, req):
{'fraction_non_alphanumeric': 0.13743293437886916, 'fraction_numerical': 0.005365249690466364, 'mean_word_length': 2.9286871961102108, 'pattern_counts': {'":': 11, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 5, 'lorem ipsum': 0, 'www.': 0, 'xml': 6}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1547078', 'n_tokens_mistral': 759, 'n_tokens_neox': 741, 'n_words': 166}