Olyno/skent

Error downloading files from api (no protocol)

SubGplayz opened this issue · 1 comments

Describe your problem

I want it to download the json file from an API I want to use, but it brings up the error that there is no protocol, and I am unsure of how to fix this or whether it can be fixed. Anybody know a fix?

Versions

Skript: 2.6
Server: Skigot 1.16.5
Skent: 3.1.0

Code

on slash command:
    if event-string = "meme":
        download from url "api.popcat.xyz/meme" to file path "plugins/tempest/meme.json"
        copy json {_meme} to {_json::*}
        reply with "%{_meme}%"

Error

[13:19:44] [download file from "api.popcat.xyz/meme" to file file/directory "plugins/tempest/meme.json"/WARN]: Exception in thread "download file from "api.popcat.xyz/meme" to file file/directory "plugins/tempest/meme.json"" java.util.concurrent.CompletionException: java.net.MalformedURLException: no protocol: api.popcat.xyz/meme
[13:19:44] [download file from "api.popcat.xyz/meme" to file file/directory "plugins/tempest/meme.json"/WARN]: at com.olyno.skent.skript.effects.EffDownloadFile.executeAsync(EffDownloadFile.java:76)
[13:19:44] [download file from "api.popcat.xyz/meme" to file file/directory "plugins/tempest/meme.json"/WARN]: at com.olyno.skent.util.skript.AsyncEffect.run(AsyncEffect.java:50)
[13:19:44] [download file from "api.popcat.xyz/meme" to file file/directory "plugins/tempest/meme.json"/WARN]: at java.base/java.lang.Thread.run(Thread.java:829)
[13:19:44] [download file from "api.popcat.xyz/meme" to file file/directory "plugins/tempest/meme.json"/WARN]: Caused by: java.net.MalformedURLException: no protocol: api.popcat.xyz/meme
[13:19:44] [download file from "api.popcat.xyz/meme" to file file/directory "plugins/tempest/meme.json"/WARN]: at java.base/java.net.URL.(URL.java:645)
[13:19:44] [download file from "api.popcat.xyz/meme" to file file/directory "plugins/tempest/meme.json"/WARN]: at java.base/java.net.URL.(URL.java:541)
[13:19:44] [download file from "api.popcat.xyz/meme" to file file/directory "plugins/tempest/meme.json"/WARN]: at java.base/java.net.URL.(URL.java:488)
[13:19:44] [download file from "api.popcat.xyz/meme" to file file/directory "plugins/tempest/meme.json"/WARN]: at com.olyno.skent.skript.effects.EffDownloadFile.executeAsync(EffDownloadFile.java:68)
[13:19:44] [download file from "api.popcat.xyz/meme" to file file/directory "plugins/tempest/meme.json"/WARN]: ... 2 more

Olyno commented

Hi 👋🏻 It simply means your url is incorrect, which is the case. An url starts either with http, or https. It's not the case with you current url. Replace api.popcat.xyz/meme with https://api.popcat.xyz/meme and it should fix the error.