예제 #1
0
 def api_response(self, **kwargs):
     """
     Dispatch a call to the api, see megacrypter.com/api_doc
     """
     self.log_debug("JSON request: " + json_dumps(kwargs))
     res = self.load(self.API_URL, post=json_dumps(kwargs))
     self.log_debug("API Response: " + res)
     return json_loads(res)
예제 #2
0
    def handlePremium(self, pyfile):
        host = self._get_host(pyfile.url)
        json_params = json_dumps({
            'link':
            pyfile.url,
            'type':
            host,
            'username':
            self.user,
            'password':
            self.account.getAccountData(self.user)['password']
        })

        r = self.load("http://gen.linksnappy.com/genAPI.php",
                      post={'genLinks': json_params})

        self.logDebug("JSON data: " + r)

        j = json_loads(r)['links'][0]

        if j['error']:
            self.error(_("Error converting the link"))

        pyfile.name = j['filename']
        self.link = j['generated']

        if host in self.SINGLE_CHUNK_HOSTERS:
            self.chunkLimit = 1
        else:
            self.setup()
예제 #3
0
    def handlePremium(self):
        api_key = self.user
        premium_key = self.account.getAccountData(self.user)["password"]

        json_data = [
            api_key,
            [
                "download/direct_links", {
                    "pass": premium_key,
                    "link": self.pyfile.url
                }
            ]
        ]
        api_rep = self.load('http://api.letitbit.net/json',
                            post={'r': json_dumps(json_data)})
        self.logDebug('API Data: ' + api_rep)
        api_rep = json_loads(api_rep)

        if api_rep['status'] == 'FAIL':
            self.fail(api_rep['data'])

        direct_link = api_rep['data'][0][0]
        self.logDebug('Direct Link: ' + direct_link)

        self.download(direct_link, disposition=True)
예제 #4
0
파일: MegaNz.py 프로젝트: JeRiKo1/pyload
    def callApi(self, **kwargs):
        """ Dispatch a call to the api, see https://mega.co.nz/#developers """
        # generate a session id, no idea where to obtain elsewhere
        uid = random.randint(10 << 9, 10 ** 10)

        resp = self.load(self.API_URL % uid, post=json_dumps([kwargs]))
        self.logDebug("Api Response: " + resp)
        return json_loads(resp)
예제 #5
0
    def callApi(self, **kwargs):
        """ Dispatch a call to the api, see https://mega.co.nz/#developers """
        # generate a session id, no idea where to obtain elsewhere
        uid = random.randint(10 << 9, 10 ** 10)

        resp = self.load(self.API_URL % uid, post=json_dumps([kwargs]))
        self.logDebug("Api Response: " + resp)
        return json_loads(resp)
예제 #6
0
파일: LetitbitNet.py 프로젝트: kurtiss/htpc
    def handlePremium(self, pyfile):
        api_key = self.user
        premium_key = self.account.getAccountData(self.user)['password']

        json_data = [api_key, ["download/direct_links", {"pass": premium_key, "link": pyfile.url}]]
        api_rep = self.load('http://api.letitbit.net/json', post={'r': json_dumps(json_data)})
        self.logDebug("API Data: " + api_rep)
        api_rep = json_loads(api_rep)

        if api_rep['status'] == 'FAIL':
            self.fail(api_rep['data'])

        self.download(api_rep['data'][0][0], disposition=True)
예제 #7
0
    def handle_premium(self, pyfile):
        api_key = self.user
        premium_key = self.account.get_info(self.user)['login']['password']

        json_data = [api_key, ["download/direct_links", {'pass': premium_key, 'link': pyfile.url}]]
        api_rep = self.load('http://api.letitbit.net/json', post={'r': json_dumps(json_data)})
        self.log_debug("API Data: " + api_rep)
        api_rep = json_loads(api_rep)

        if api_rep['status'] == "FAIL":
            self.fail(api_rep['data'])

        self.link = api_rep['data'][0][0]
예제 #8
0
    def handlePremium(self, pyfile):
        api_key = self.user
        premium_key = self.account.getAccountData(self.user)['password']

        json_data = [api_key, ["download/direct_links", {"pass": premium_key, "link": pyfile.url}]]
        api_rep = self.load('http://api.letitbit.net/json', post={'r': json_dumps(json_data)})
        self.logDebug("API Data: " + api_rep)
        api_rep = json_loads(api_rep)

        if api_rep['status'] == 'FAIL':
            self.fail(api_rep['data'])

        self.link = api_rep['data'][0][0]
예제 #9
0
    def process(self, pyfile):
        if re.match(self.__pattern__, pyfile.url):
            new_url = pyfile.url
        elif not self.account:
            self.logError(
                _("Please enter your %s account or deactivate this plugin") %
                "Linksnappy.com")
            self.fail("No Linksnappy.com account provided")
        else:
            self.logDebug("Old URL: %s" % pyfile.url)
            host = self._get_host(pyfile.url)
            json_params = json_dumps({
                'link':
                pyfile.url,
                'type':
                host,
                'username':
                self.user,
                'password':
                self.account.getAccountData(self.user)["password"]
            })
            r = self.load('http://gen.linksnappy.com/genAPI.php',
                          post={'genLinks': json_params})
            self.logDebug("JSON data: " + r)

            j = json_loads(r)['links'][0]

            if j['error']:
                self.logError('Error converting the link: %s' % j['error'])
                self.fail('Error converting the link')

            pyfile.name = j['filename']
            new_url = j['generated']

            if host in self.SINGLE_CHUNK_HOSTERS:
                self.chunkLimit = 1
            else:
                self.setup()

        if new_url != pyfile.url:
            self.logDebug("New URL: " + new_url)

        self.download(new_url, disposition=True)

        check = self.checkDownload({"html302": "<title>302 Found</title>"})
        if check == "html302":
            self.retry(wait_time=5,
                       reason="Linksnappy returns only HTML data.")
예제 #10
0
    def handle_premium(self, pyfile):
        host        = self._get_host(pyfile.url)
        json_params = json_dumps({'link'    : pyfile.url,
                                  'type'    : host,
                                  'username': self.user,
                                  'password': self.account.get_info(self.user)['login']['password']})

        r = self.load("http://linksnappy.com/api/linkgen",
                      post={'genLinks': json_params})

        self.log_debug("JSON data: " + r)

        j = json_loads(r)['links'][0]

        if j['error']:
            self.error(_("Error converting the link"))

        pyfile.name = j['filename']
        self.link   = j['generated']
예제 #11
0
    def process(self, pyfile):
        if re.match(self.__pattern__, pyfile.url):
            new_url = pyfile.url
        elif not self.account:
            self.logError(_("Please enter your %s account or deactivate this plugin") % "Linksnappy.com")
            self.fail("No Linksnappy.com account provided")
        else:
            self.logDebug("Old URL: %s" % pyfile.url)
            host = self._get_host(pyfile.url)
            json_params = json_dumps({'link': pyfile.url,
                                      'type': host,
                                      'username': self.user,
                                      'password': self.account.getAccountData(self.user)["password"]})
            r = self.load('http://gen.linksnappy.com/genAPI.php',
                          post={'genLinks': json_params})
            self.logDebug("JSON data: " + r)

            j = json_loads(r)['links'][0]

            if j['error']:
                self.logError('Error converting the link: %s' % j['error'])
                self.fail('Error converting the link')

            pyfile.name = j['filename']
            new_url = j['generated']

            if host in self.SINGLE_CHUNK_HOSTERS:
                self.chunkLimit = 1
            else:
                self.setup()

        if new_url != pyfile.url:
            self.logDebug("New URL: " + new_url)

        self.download(new_url, disposition=True)

        check = self.checkDownload({"html302": "<title>302 Found</title>"})
        if check == "html302":
            self.retry(wait_time=5, reason="Linksnappy returns only HTML data.")
예제 #12
0
    def handlePremium(self, pyfile):
        host        = self._get_host(pyfile.url)
        json_params = json_dumps({'link'    : pyfile.url,
                                  'type'    : host,
                                  'username': self.user,
                                  'password': self.account.getAccountData(self.user)['password']})

        r = self.load("http://gen.linksnappy.com/genAPI.php",
                      post={'genLinks': json_params})

        self.logDebug("JSON data: " + r)

        j = json_loads(r)['links'][0]

        if j['error']:
            self.error(_("Error converting the link"))

        pyfile.name = j['filename']
        self.link   = j['generated']

        if host in self.SINGLE_CHUNK_HOSTERS:
            self.chunkLimit = 1
        else:
            self.setup()
예제 #13
0
 def callApi(self, **kwargs):
     """ Dispatch a call to the api, see megacrypter.com/api_doc """
     self.logDebug("JSON request: " + json_dumps(kwargs))
     resp = self.load(self.API_URL, post=json_dumps(kwargs))
     self.logDebug("API Response: " + resp)
     return json_loads(resp)
예제 #14
0
def api_response(url):
    json_data = ["yw7XQy2v9", ["download/info", {"link": url}]]
    api_rep   = getURL("http://api.letitbit.net/json",
                       post={'r': json_dumps(json_data)})
    return json_loads(api_rep)
예제 #15
0
파일: LetitbitNet.py 프로젝트: kurtiss/htpc
def api_response(url):
    json_data = ["yw7XQy2v9", ["download/info", {"link": url}]]
    api_rep   = getURL("http://api.letitbit.net/json",
                       post={'r': json_dumps(json_data)})
    return json_loads(api_rep)
예제 #16
0
def api_download_info(url):
    json_data = ['yw7XQy2v9', ["download/info", {"link": url}]]
    post_data = urllib.urlencode({'r': json_dumps(json_data)})
    api_rep = urllib.urlopen('http://api.letitbit.net/json',
                             data=post_data).read()
    return json_loads(api_rep)
예제 #17
0
def api_download_info(url):
    json_data = ['yw7XQy2v9', ["download/info", {"link": url}]]
    post_data = urllib.urlencode({'r': json_dumps(json_data)})
    api_rep = urllib.urlopen('http://api.letitbit.net/json', data=post_data).read()
    return json_loads(api_rep)