emergency switched roblox api calls to proxies since roblox is blocking datacenter ips
This commit is contained in:
1 parent
670512944c
commit
55df89c02b
2 files changed
+51
-45
No files matched your search
@@ -6,7 +6,7 @@ const fs = require('fs');
|
||||
const logger = require('../../utils/logger');
|
||||
|
||||
async function fetch_avatar(id) {
|
||||
const res = await fetch(`https://thumbnails.roblox.com/v1/users/avatar?userIds=${id}&size=420x420&format=Png&isCircular=false`, {
|
||||
const res = await fetch(`https://thumbnails.roproxy.com/v1/users/avatar?userIds=${id}&size=420x420&format=Png&isCircular=false`, {
|
||||
method: 'GET',
|
||||
headers: { 'Content-Type': 'application/json' }
|
||||
});
|
||||
@@ -22,7 +22,7 @@ async function fetch_avatar(id) {
|
||||
}
|
||||
|
||||
async function fetch_item_thumb(id) {
|
||||
const res = await fetch(`https://thumbnails.roblox.com/v1/assets?assetIds=${id}&returnPolicy=PlaceHolder&size=420x420&format=Png&isCircular=false`, {
|
||||
const res = await fetch(`https://thumbnails.roproxy.com/v1/assets?assetIds=${id}&returnPolicy=PlaceHolder&size=420x420&format=Png&isCircular=false`, {
|
||||
method: 'GET',
|
||||
headers: { 'Content-Type': 'application/json' }
|
||||
});
|
||||
@@ -96,14 +96,14 @@ module.exports = {
|
||||
|
||||
if (subcommand === 'user') {
|
||||
try {
|
||||
const res = await fetch(`https://users.roblox.com/v1/usernames/users`, {
|
||||
const res = await fetch(`https://users.roproxy.com/v1/usernames/users`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ usernames: [argument], excludeBannedUsers: false })
|
||||
});
|
||||
const data = await res.json();
|
||||
|
||||
const extra_res = await fetch(`https://users.roblox.com/v1/users/${data.data[0].id}`, {
|
||||
const extra_res = await fetch(`https://users.roproxy.com/v1/users/${data.data[0].id}`, {
|
||||
method: 'GET',
|
||||
headers: { 'Content-Type': 'application/json' }
|
||||
});
|
||||
@@ -113,7 +113,13 @@ module.exports = {
|
||||
method: 'GET',
|
||||
headers: { 'Content-Type': 'application/json' }
|
||||
});
|
||||
const r_data = await r_res.json();
|
||||
let r_data = {};
|
||||
if (r_res.ok) {
|
||||
r_data = await r_res.json();
|
||||
} else {
|
||||
logger.warn(`[rbx] Failed to fetch rolimons playerinfo for id ${data.data[0].id}: HTTP ${r_res.status}`);
|
||||
r_data = {};
|
||||
}
|
||||
|
||||
const ra_res = await fetch(`https://api.rolimons.com/players/v1/playerassets/${data.data[0].id}`, {
|
||||
method: 'GET',
|
||||
@@ -197,9 +203,9 @@ module.exports = {
|
||||
}
|
||||
} else if (subcommand === 'item') {
|
||||
try {
|
||||
const res = await fetch(`https://economy.roblox.com/v2/assets/${argument}/details`);
|
||||
const p_res = await fetch(`https://thumbnails.roblox.com/v1/ assets?assetIds=${argument}&returnPolicy=PlaceHolder&size=420x420&format=Png&isCircular=false`)
|
||||
const resale_res = await fetch(`https://economy.roblox.com/v1/assets/${argument}/resale-data`);
|
||||
const res = await fetch(`https://economy.roproxy.com/v2/assets/${argument}/details`);
|
||||
const p_res = await fetch(`https://thumbnails.roproxy.com/v1/ assets?assetIds=${argument}&returnPolicy=PlaceHolder&size=420x420&format=Png&isCircular=false`)
|
||||
const resale_res = await fetch(`https://economy.roproxy.com/v1/assets/${argument}/resale-data`);
|
||||
|
||||
const item = await res.json();
|
||||
logger.debug(`[rbx] fetched item data (roblox) for "${argument}": ${JSON.stringify(item)}`);
|
||||
@@ -274,8 +280,8 @@ module.exports = {
|
||||
}
|
||||
} else if (subcommand === 'group') {
|
||||
try {
|
||||
const res = await fetch(`https://groups.roblox.com/v1/groups/${argument}`);
|
||||
const p_res = await fetch(`https://thumbnails.roblox.com/v1/groups/icons?groupIds=${argument}&size=420x420&format=Png&isCircular=false`);
|
||||
const res = await fetch(`https://groups.roproxy.com/v1/groups/${argument}`);
|
||||
const p_res = await fetch(`https://thumbnails.roproxy.com/v1/groups/icons?groupIds=${argument}&size=420x420&format=Png&isCircular=false`);
|
||||
|
||||
if (!res.ok) throw new Error();
|
||||
if (!p_res.ok) throw new Error();
|
||||
@@ -317,7 +323,7 @@ module.exports = {
|
||||
}
|
||||
} else if (subcommand === 'game') {
|
||||
try {
|
||||
const res = await fetch(`https://games.roblox.com/v1/games?universeIds=${argument}`);
|
||||
const res = await fetch(`https://games.roproxy.com/v1/games?universeIds=${argument}`);
|
||||
if (!res.ok) throw new Error();
|
||||
const data = await res.json();
|
||||
if (!data.data || !data.data[0]) {
|
||||
|
||||
Reference in new issue
Block a user