I Created a Roblox Group Item Fetcher

so i had a commission on fiverr (i work as a roblox scripter there), and someone hired me to make an avatar shop with his UGC (from a group), i tried so many times to make a script that fetches items automatically based on the bits but i keept getting 400 error , so i got to vs code with python and started working :smiley:

this is what i did:

import requests

group_id = 10447595  # target Group ID
url = "https://catalog.roblox.com/v1/search/items/details"
params = {
    "CreatorType": "2",  # only items created by the group
    "CreatorTargetId": group_id,  # id
    "Category": "11",  
    "Subcategory": "26",  
    "SortAggregation": "5",  
    "SortType": "0", 
    "Limit": "30"  
}
# visit https://create.roblox.com/docs/projects/assets/api#marketplace-api for more details on the parameters
 
def fetch_all_items():
    items = []
    next_cursor = None

    while True:
   
        if next_cursor:
            params["Cursor"] = next_cursor

        response = requests.get(url, params=params)

        if response.status_code == 200:
            data = response.json()
            print(f"Fetched {len(data['data'])} items...")

            
            items.extend(data['data'])

            
            next_cursor = data.get('nextPageCursor')

          
            if not next_cursor:
                break
        else:
            print(f"Failed to fetch data. Error code: {response.status_code}")
            break

    return items


def save_items_to_file(items, filename="items.txt"):
    with open(filename, "w") as file:
        file.write("return {\n")
        for item in items:
           
            if 'name' in item and 'id' in item:
                file.write(f'    {{Id = {item["id"]}, Name = "{item["name"]}"}} ,\n')
        file.write("}\n")


items = fetch_all_items()


save_items_to_file(items)

print("All items have been saved to 'items.txt'.")

it was EXTREMELY helpful, this solved my problem really fast cuz i dont need to go search manually and changing Cursor manually !!!

also u can andjust the output, in my case i set it to:

return {
	{Id = 17164022736, Name = "Milkshake"} ,
	{Id = 12854443148, Name = "Walkie-Talkie"} ,
	{Id = 12514992588, Name = "Black Cyber Gun"} ,
	{Id = 76626061310386, Name = "cutecore strawberry purse"} ,
	{Id = 12854448906, Name = "Security Flashlight"} ,
	{Id = 12514977913, Name = "White Cyber Gun"} ,
	{Id = 12514797703, Name = "Pink Cyber Gun"} ,
	{Id = 12854437403, Name = "Security Guard Badge"} ,
	{Id = 17164017279, Name = "Boba Milk Tea"} ,
	{Id = 17164019990, Name = "Strawberry Milkshake"} ,
	{Id = 12514937086, Name = "Green Cyber Gun"} ,
	{Id = 12294467327, Name = "Heart Shoulder Bag"} ,
	{Id = 12514911444, Name = "Orange Cyber Gun"} ,
	{Id = 12514855984, Name = "Blue Cyber Gun"} ,
}
1 Like

Did the guy specifically ask for a python code?
If not I’d say go with HttpService and use something like roproxy.

2 Likes

Ugh, sorry, its just if anyone needs a fast fetcher tool , i changed category