AudioDownloadAPI/static/index.html

226 lines
5.8 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="og:title" content="Roblox Asset API">
<meta property="og:description" content="Bulk conversion of asset IDs to download URLs!">
<meta property="og:image" content="https://example.com/image.jpg">
<meta property="og:url" content="https://audio.kcadev.org">
<meta property="og:type" content="website">
<title>Roblox Asset API Documentation</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 20px;
background-color: #222;
color: #fff;
}
h1 {
color: #fff;
}
pre {
background-color: #333;
color: #fff;
padding: 15px;
border-radius: 5px;
overflow-x: auto;
}
.container {
max-width: 800px;
margin: 0 auto;
background-color: #333;
padding: 20px;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
a {
color: #00c3ca;
text-decoration: underline;
}
</style>
</head>
</head>
<body>
<h1>Roblox Asset API Documentation</h1>
<p>This project is open source and you can find the code on <a href="https://git.chrischro.me/KCA/AudioDownloadAPI">Forgejo</a>.</p>
<p>We do not store any personal information. We only log a timestamp, IP address, HTTP method, and path for debugging and spam monitoring purposes. These logs are shown in the console and cleared daily.</p>
<p>
We have a Discord Bot! You can add it to your server or user <a href="https://discord.com/oauth2/authorize?client_id=1281325349858447542">here!</a>
You can join the KCA Discord <a href="https://l.kcadev.org/discord">here!</a>
</p>
<div>
<h2>Demo</h2>
<form id="demoForm">
<label for="assetIds">Asset IDs (Separated by new line):</label>
<br>
<textarea id="assetIds" name="assetIds" required></textarea>
<br>
<label for="cookie">Cookie:</label>
<br>
<input type="password" id="cookie" name="cookie">
<br>
<button type="submit">Submit</button>
</form>
<div id="output"></div>
</div>
<script>
document.getElementById("demoForm").addEventListener("submit", function(event) {
event.preventDefault();
var assetIds = document.getElementById("assetIds").value;
var cookie = document.getElementById("cookie").value;
var xhr = new XMLHttpRequest();
xhr.open("POST", "/", true);
xhr.setRequestHeader("Content-Type", "application/json");
xhr.onreadystatechange = function() {
if (xhr.readyState === XMLHttpRequest.DONE && xhr.status === 200) {
var response = JSON.parse(xhr.responseText);
var output = document.getElementById("output");
output.innerHTML = "<pre>" + JSON.stringify(response, null, 4) + "</pre>";
}
};
var data = {
"type": "batching",
"data": assetIds.split("\n"),
"cookie": cookie
};
xhr.send(JSON.stringify(data));
});
</script>
<h2>Request Format</h2>
<p>The request must be sent as JSON with the following format:</p>
<pre>
{
"type": "batching",
"data": [
"assetId1",
"assetId2",
...
],
"cookie": "optional-roblosecurity-cookie"
}
</pre>
<p><strong>Parameters:</strong></p>
<ul>
<li><code>type</code>: The type of the request. Must be <code>"batching"</code>.</li>
<li><code>data</code>: An array of asset IDs that you want to request.</li>
<li><code>cookie</code>: Optional. A <code>.ROBLOSECURITY</code> cookie. If not provided, you will only be
able to access public assets. The cookie is used once to make the request to Roblox servers and is then
discarded permanently.
You can find more information on obtaining your cookie <a
href="https://noblox.js.org/tutorial-VPS%20Authentication.html">here!</a></li>
</ul>
<h2>Rate Limit</h2>
<p>There is a limit of 25 requests per minute. If this limit is exceeded, the following error will be returned:
</p>
<pre>
{
"code": 429,
"error": "Rate limit exceeded",
"status": "error"
}
</pre>
<h2>Response Format</h2>
<p>The response will be in JSON format:</p>
<pre>
<pre>
{
"type": "batching-response",
"data": {
"assetId1": {
"status": "success",
"url": "location_of_asset",
},
"assetId2": {
"status": "failure",
"code": error_code,
"message": "error_message",
"additional": "additional_information"
}
}
}
</pre>
</pre>
<p><strong>Fields:</strong></p>
<ul>
<li><code>type</code>: Always <code>"batching-response"</code>.</li>
<li><code>data</code>: An object where each key is an asset ID and the value contains the result of the
request.</li>
<li><code>status</code>: Either <code>"success"</code> or <code>"failure"</code>.</li>
<li><code>url</code>: The location of the asset if the request was successful, or an empty string if it
failed.</li>
<li><code>additional</code>: Any additional information, such as error messages.</li>
</ul>
<h2>Example Request</h2>
<pre>
POST /
Content-Type: application/json
{
"type": "batching",
"data": [
"1837070127",
"1842241530",
"1838857104",
"123412341234",
"114870793726467"
]
}
</pre>
<h2>Example Response</h2>
<pre>
{
"type": "batching-response",
"data": {
"1837070127": {
"status": "success",
"url": "https://c6.rbxcdn.com/bfe94941622e26b7a7553ebd31cdbbd4"
},
"1838857104": {
"status": "success",
"url": "https://c4.rbxcdn.com/fa7eef8201e25978df17cccc955849b8"
},
"1842241530": {
"status": "success",
"url": "https://c1.rbxcdn.com/d12b63528d0039017313f0ee8eeb2f88"
},
"123412341234": {
"status": "failure",
"code": 404,
"message": "Not Found",
"additional": "The requested page could not be found but may be available again in the future."
},
"114870793726467": {
"status": "failure",
"code": 403,
"message": "Forbidden",
"additional": "The request was a legal request, but the server is refusing to respond to it."
}
}
}
</pre>
</div>
</body>
</html>