Search code examples
pythonjsonjdownloader

JDownloader API json.decoder.JSONDecodeError


I am using the python API of JDownloader myjdapi

With the device.linkgrabber.query_links() I got the following object:

{'enabled': True, 'name': 'EQJ_X8gUcAMQX13.jpg', 'packageUUID': 1581524887390, 'uuid': 1581524890696, 'url': 'https://pbs.twimg.com/media/x.jpg?name=orig', 'availability': 'ONLINE'}

Now I want to move to the download list with the function:

device.linkgrabber.move_to_downloadlist('1581524890696', '1581524887390')

The move_to_downloadlist function (githubrepo) says:

  def move_to_downloadlist(self, link_ids, package_ids):
        """
        Moves packages and/or links to download list.
        :param package_ids: Package UUID's.
        :type: list of strings.
        :param link_ids: Link UUID's.
        """
        params = [link_ids, package_ids]
        resp = self.device.action(self.url + "/moveToDownloadlist", params)
        return resp

But I get always json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

The official API said its a 200 Error, and the reason can be anything.

How I can fix that?


Solution

  • The parameter names are link_ids and package_ids, that's plural. That would be a good indication that lists are expected here, not single values.

    Try this:

    device.linkgrabber.move_to_downloadlist(['1581524890696'], ['1581524887390'])