Problems with roblox catalog apis

  • Basically, i want to get notified when a new item is added to the roblox catalog.

  • I tried using a json page, and i did get the urls, names, creators, prices, ect…
    but not what i wanted.

  • Refreshing every second, but it takes too much internet, and cpu space in my pc.

    • Please help me

This is a support category for asking questions about how to get something done on the Roblox websites or how to do something on Roblox applications such as Roblox Studio.

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!

  2. What is the issue? Include screenshots / videos if possible!

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

I responded here: Needing help with catalog api - #9 by hihi250.

I don’t want it to refresh every minute, i want using (maybe) java script to know that the site changed smth without refreshing the page, any idea about that?

What do you mean? You can only check if a page has changed by making a request and looking at its content. I don’t know what you mean. Do you want to do it in Javascript instead?

Any language will work, as long as i can know when a site has changed its content without refreshing the page, i don’t really care if it was js, python or anything else, just a way i can know with, and as far as i searched, ig its only possible by js

wait so as you said here, rolimons do it like this?
coz i asked him and he said he uses python to run discord bot and uses some of the roblox catalog apis and sum of js

It’s possible in any language, as long as you’re able to make HTTP requests. I gave you a script in Python, using the requests library (which allows HTTP requests), and if you want to do it in browser Javascript, you can use XMLHttpRequest, fetch, or Ajax. In Node.js, you can use Axios.

In browser JS (using localStorage):

const url = 'https://catalog.roblox.com/v2/search/items/details?Category=1&CreatorName=Roblox&salesTypeFilter=2&SortType=3&limit=10';
const previousContentStorageKey = 'previous_content';

function readPreviousContent() {
  return localStorage.getItem(previousContentStorageKey) || '';
}

function writeCurrentContent(content) {
  localStorage.setItem(previousContentStorageKey, content);
}

async function checkForChanges() {
  const previousContent = readPreviousContent();

  try {
    const response = await fetch(url);
    const currentContent = await response.text();

    if (currentContent !== previousContent) {
      console.log(currentContent);
      writeCurrentContent(currentContent);
    }
  } catch (error) {
    console.error(error.message);
  }
}

const interval = 60000;

setInterval(checkForChanges, interval);
checkForChanges();

i don’t really understand js, well i can if i focus, but like this no, so can u tell me what this does and how it works, lol sorry

image
look

It doesn’t really matter which language you use. It’s just a personal preference, although I’d recommend Python over Node for beginners. I prefer Node because I’m used to Javascript. Use whatever is best for you.

Like I said, I’d recommend Python for beginners. For smaller servers (like your computer), it’s also probably less-resource intensive than a Node environment. I gave you an example Python script on the other post.

Hey dude, i just want a answer to this question, by yes or no.

  • Using js, can i get notified (print, playing sound, ect…) when a website has changed something / added something / removed something?

  • If yes, what about python?

Yes. I gave examples in both Javascript and Python. If you need help with anything, just let me know.

1 Like

Thanks this really means alot to me, just to be sure, you gave examples in the post number number 6 right?

i mean this post the one with js code, right?

@hihi250 i don’t really know if i mentioned that but my main thing from this topic is to know how to get changes to a site without refreshing the page every x seconds

I’ll just give you the examples here.

Python:

import requests
import time

url = "https://catalog.roblox.com/v2/search/items/details?Category=1&CreatorName=Roblox&salesTypeFilter=2&SortType=3&limit=10"
previous_content = "" # Stores the previous content

while True:
    try:
        response = requests.get(url)
        response.raise_for_status()

        current_content = response.text

        if current_content != previous_content:
            print("a limited was added:")
            print(current_content)

        previous_content = current_content

        time.sleep(60)

    except requests.exceptions.RequestException as e:
        print(f"error: {e}")

    except KeyboardInterrupt:
        break

Browser Javascript:

const url = 'https://catalog.roblox.com/v2/search/items/details?Category=1&CreatorName=Roblox&salesTypeFilter=2&SortType=3&limit=10';
const previousContentStorageKey = 'previous_content';

function readPreviousContent() {
  return localStorage.getItem(previousContentStorageKey) || '';
}

function writeCurrentContent(content) {
  localStorage.setItem(previousContentStorageKey, content);
}

async function checkForChanges() {
  const previousContent = readPreviousContent();

  try {
    const response = await fetch(url);
    const currentContent = await response.text();

    if (currentContent !== previousContent) {
      console.log(currentContent);
      writeCurrentContent(currentContent);
    }
  } catch (error) {
    console.error(error.message);
  }
}

const interval = 60000;

setInterval(checkForChanges, interval);
checkForChanges();

You’ll have to modify the browser Javascript if you’re going to use Node.

I still don’t know what you mean. Obviously the only way of checking the content of a page is to visit the page itself. And to check against the content for new content, you have to make another request. You could make the trigger anything - it doesn’t have to be every X amount of time - but that’s the normal way of repeatedly checking automatically.

Ima give you an example, you made a web page (robloxDevs.com), in this page, there is a json code, and the json code is:

{text1:["hello"]}

I opened your web page (robloxDevs.com) and the json page appeared to me ({text1:["hello"]})

you updated the page to:

{text1:["bye"]}

I still didn’t refresh my page so i see {text1:["hello"]}, can’t i know that you changed the page WITHOUT refreshing my own?

Obviously you can’t check the updated content of a page without making another request.