[lib] Mediafire Library - Directly download!

Discussion in 'Resources' started by ZeusAllMighty11, Aug 15, 2013.

Thread Status:
Not open for further replies.
  1. Hey guys,

    This is a library which will allow you to easily upload and download from Mediafire in Java.

    - Mediafire account (email,password,app id, app key)

    How does it work?
    Although Dropbox is commonly used for filehosting, many still use Mediafire. And as a result, it can be a pain in the butt to go to the mediafire link, enter a captcha (?), and then download. So instead, you don't ever need to open your browser. This could allow things such as auto map/mod downloaders from Minecraftforum, etc.

    How to use it:
    /* This generates a 10 minute temporary session so we can have access to uploads/downloads */
    Session sesh = MediafireAPI.getSession("[email protected]", "mypassword", appID, "MyAppKey1278931293");
    /* Let's download a file */
    MediafireAPI.download("keyOfFile", new File("./cats.txt"), sesh);
    // keyOfFile  is the file code
    // the second argument is File
    // Third argument is a session which isn't inactive
    At the moment I haven't worked on uploading. Also, you will have to already know the file extension, because I can't assume the file you are downloading is txt or a zip or a rar archive. I'd just say use accordingly for now.

    How to be a Mediafire dev:

    1) Login to Mediafire, and click on your profile picture and go to settings
    2) You'll see something like this:

    Show Spoiler

    3) Click on 'developers'
    4) Click ' create new application'
    5) Enter out info as you wish
    6) When it's finished, click on developers again and you will see your app with your application id and your api key.

    How to find a download code:
    'download code' is the small code in the link of a download.
    An example download would look like:
    <Edit by Moderator: Redacted mediafire url>
    After the 'view' is the download code. This can be obtained with httprequests by parsing the json response

    That's it. I'm still working on the uploading, and the file extension detection, but the downloading works.

    Thanks to lol768

    <Edit by Moderator: Redacted mediafire url>
    Last edited by a moderator: Nov 5, 2016
  2. Would anything using this be allowed on bukkitdev? It seems like it could be a big security hole. Sending a texturepack seems to be a security risk for some of the staff even.
  3. epicfacecreeper Yes it probably will be allowed if you can disable it...
  4. CaptainBern epicfacecreeper

    I am not positive, but as long as your plugin clearly states exactly what happens and there is a detailed way how to disable it, I believe it would be okay. CoreProtect allows for automatic downloads and it has a toggle.

    To be safe I'd say not to, as it's better just to redirect your users to your plugin page so they can also see a changelog, etc.

    I'll look into it more
Thread Status:
Not open for further replies.

Share This Page