Jump to content

G.E API and Items image - Question


Consulti

Recommended Posts

Hello everyone 👋,

I'm currently working on a project and I'm having a hard time finding an update G.E API for osrs that contains the product image so I can have both updated value and image for my website, do you guys have any idea where I can get both?

For the G.E API, I'm using the one provided by rsbuddy (open for better suggestions) and for the item image, I'd need to make a call to get the item icon from services.runescape

Do you guys have any suggestion to make this process easier? 

Link to comment
Share on other sites

  • 3 months later...

Hello everyone,

I'd like to revive this topic as me and some friends are getting back to this idea to play around. Unfortunately, the reddit post provided by Apaec is a bit outdated, is there any other suggestion available at the moment?

I'm trying to get high quality images of each item, like the ones provided by https://oldschool.runescape.wiki/ and a valid G.E API to fetch the prices, so the problem here is:

  • Finding the items database;
  • Link them to a valid website with images that we can download;
  • G.E value of each one of these items.

Do you have any suggestion for that?

Link to comment
Share on other sites

This is my code for One of my ge merchers

I cant find my Id-> price code

https://prnt.sc/sdtqu3

https://prnt.sc/sdtr35

Query  -> sub-set of data-base


        textField1.getDocument().addDocumentListener(new DocumentListener(){


            @Override
            public void insertUpdate(DocumentEvent e) {
                String text = textField1.getText();

                if (text.trim().length() == 0) {
                    rowSorter.setRowFilter(null);
                } else {
                    rowSorter.setRowFilter(RowFilter.regexFilter("(?i)" + text));
                }
            }

            @Override
            public void removeUpdate(DocumentEvent e) {
                String text = textField1.getText();

                if (text.trim().length() == 0) {
                    rowSorter.setRowFilter(null);
                } else {
                    rowSorter.setRowFilter(RowFilter.regexFilter("(?i)" + text));
                }
            }

            @Override
            public void changedUpdate(DocumentEvent e) {
                throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
            }

        });

 

Clicking on item -> name/id

   table1.addMouseListener(new java.awt.event.MouseAdapter() {
            @Override
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                int row = table1.rowAtPoint(evt.getPoint());
                int col = table1.columnAtPoint(evt.getPoint());
                if (row >= 0 && col >= 0) {
                    table1.getValueAt( row,  col);
                    ItemName.setText((String) table1.getValueAt( row,  0));


                }
            }
        });

 

 

 

Id-> Item (might want to add 1 more hash map that is <string,Items> to do name-> item->id )

public class ItemGuide {
    private static final Map<Long, Item> allGEItems = new HashMap<>();
    private static final List<Object[]> GeItems= new ArrayList<>();



    public static Object[][] getAllGEItems() {
        if (allGEItems.isEmpty()) {

            File summaryFile = Paths.get(System.getProperty("user.home"), "OSBot", "Data", "items-cache-data.json").toFile();
            try {
                if (!summaryFile.exists()) {

                    URL website = new URL("https://raw.githubusercontent.com/osrsbox/osrsbox-db/master/data/items/items-cache-data.json");
                    ReadableByteChannel rbc = Channels.newChannel(website.openStream());
                    FileOutputStream fos = new FileOutputStream(summaryFile);
                    fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
                }

                try (FileReader fileReader = new FileReader(summaryFile)) {
                    JSONObject jsonObject = (JSONObject) (new JSONParser().parse(fileReader));
                    for (Object value : jsonObject.values()) {
                        JSONObject item = (JSONObject) value;
                        if ((Boolean) item.get("tradeable_on_ge")){

                            allGEItems.put((Long) item.get("id"),new Item().setId((Long) item.get("id"))
                                    .setMembers((Boolean) item.get("members"))
                                    .setName((String) item.get("name"))
                            );

                        }
                    }

                }
            } catch (IOException | ParseException e) {
                e.printStackTrace();
            }
             summaryFile = Paths.get(System.getProperty("user.home"), "OSBot", "Data", "ge-limits-ids.json").toFile();
            try {
                if (!summaryFile.exists()) {
                    URL website = new URL("https://raw.githubusercontent.com/osrsbox/osrsbox-db/master/data/items/ge-limits-ids.json");
                    ReadableByteChannel rbc = Channels.newChannel(website.openStream());
                    FileOutputStream fos = new FileOutputStream(summaryFile);
                    fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
                }
                try (FileReader fileReader = new FileReader(summaryFile)) {
                    JSONObject jsonObject = (JSONObject) (new JSONParser().parse(fileReader));
                    for (Object value : jsonObject.keySet()) {

                        if (allGEItems.containsKey(Long.valueOf((String) value) )){

                            System.out.println(jsonObject.get(value));

                            if (jsonObject.get(value)!=null){

                                allGEItems.get(Long.valueOf((String) value)).setBuyLimit((Long) jsonObject.get(value));

                            }else {
                                allGEItems.get(Long.valueOf((String) value)).setBuyLimit(-1);



                            }

                        }

                    }

                }
            } catch (IOException | ParseException e) {
                e.printStackTrace();
            }



        }
        allGEItems.values().forEach(s->GeItems.add(s.getItem()));
        Object[][] array2d = GeItems.toArray(new Object[GeItems.size()][]);
        return array2d;
    }


    public static Map<Long, Item> getGeItems() {
        if (allGEItems.isEmpty()){
            getAllGEItems();

        }
        return allGEItems;
    }
}

 

 

 

Id -> Image

   Image image =null;

    private void drawitem(){
        if (image ==null){

            URL url = null;

            try {
                url = new URL("https://rsbuddy.com/items/" + itemid+".png");
            } catch (MalformedURLException e) {
                e.printStackTrace();
            }

            try {
                image = ImageIO.read(url);

            } catch (IOException e) {
                e.printStackTrace();
            }

        }
        Graphics g = c.getGraphics();
        Graphics2D g2 = (Graphics2D) g;
        if (image!=null){

            g.drawImage(image, 55, 50,60,60,null );
            g.setColor(lowlites);
            g2.setStroke(new BasicStroke(3));

        }else {
            drawText("ERROR", 50 ,50,Color.white,font1);
        }
        
        g2.setStroke(new BasicStroke(1));
        g.setColor(Color.black);
        g2.draw(new RoundRectangle2D.Double(50, 50, 60, 60, 10, 10));

    }

 

 

Edited by Nbacon
Link to comment
Share on other sites

11 hours ago, Nbacon said:

This is my code for One of my ge merchers

I cant find my Id-> price code

https://prnt.sc/sdtqu3

https://prnt.sc/sdtr35

Query  -> sub-set of data-base



        textField1.getDocument().addDocumentListener(new DocumentListener(){


            @Override
            public void insertUpdate(DocumentEvent e) {
                String text = textField1.getText();

                if (text.trim().length() == 0) {
                    rowSorter.setRowFilter(null);
                } else {
                    rowSorter.setRowFilter(RowFilter.regexFilter("(?i)" + text));
                }
            }

            @Override
            public void removeUpdate(DocumentEvent e) {
                String text = textField1.getText();

                if (text.trim().length() == 0) {
                    rowSorter.setRowFilter(null);
                } else {
                    rowSorter.setRowFilter(RowFilter.regexFilter("(?i)" + text));
                }
            }

            @Override
            public void changedUpdate(DocumentEvent e) {
                throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
            }

        });

 

Clicking on item -> name/id


   table1.addMouseListener(new java.awt.event.MouseAdapter() {
            @Override
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                int row = table1.rowAtPoint(evt.getPoint());
                int col = table1.columnAtPoint(evt.getPoint());
                if (row >= 0 && col >= 0) {
                    table1.getValueAt( row,  col);
                    ItemName.setText((String) table1.getValueAt( row,  0));


                }
            }
        });

 

 

 

Id-> Item (might want to add 1 more hash map that is <string,Items> to do name-> item->id )


public class ItemGuide {
    private static final Map<Long, Item> allGEItems = new HashMap<>();
    private static final List<Object[]> GeItems= new ArrayList<>();



    public static Object[][] getAllGEItems() {
        if (allGEItems.isEmpty()) {

            File summaryFile = Paths.get(System.getProperty("user.home"), "OSBot", "Data", "items-cache-data.json").toFile();
            try {
                if (!summaryFile.exists()) {

                    URL website = new URL("https://raw.githubusercontent.com/osrsbox/osrsbox-db/master/data/items/items-cache-data.json");
                    ReadableByteChannel rbc = Channels.newChannel(website.openStream());
                    FileOutputStream fos = new FileOutputStream(summaryFile);
                    fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
                }

                try (FileReader fileReader = new FileReader(summaryFile)) {
                    JSONObject jsonObject = (JSONObject) (new JSONParser().parse(fileReader));
                    for (Object value : jsonObject.values()) {
                        JSONObject item = (JSONObject) value;
                        if ((Boolean) item.get("tradeable_on_ge")){

                            allGEItems.put((Long) item.get("id"),new Item().setId((Long) item.get("id"))
                                    .setMembers((Boolean) item.get("members"))
                                    .setName((String) item.get("name"))
                            );

                        }
                    }

                }
            } catch (IOException | ParseException e) {
                e.printStackTrace();
            }
             summaryFile = Paths.get(System.getProperty("user.home"), "OSBot", "Data", "ge-limits-ids.json").toFile();
            try {
                if (!summaryFile.exists()) {
                    URL website = new URL("https://raw.githubusercontent.com/osrsbox/osrsbox-db/master/data/items/ge-limits-ids.json");
                    ReadableByteChannel rbc = Channels.newChannel(website.openStream());
                    FileOutputStream fos = new FileOutputStream(summaryFile);
                    fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
                }
                try (FileReader fileReader = new FileReader(summaryFile)) {
                    JSONObject jsonObject = (JSONObject) (new JSONParser().parse(fileReader));
                    for (Object value : jsonObject.keySet()) {

                        if (allGEItems.containsKey(Long.valueOf((String) value) )){

                            System.out.println(jsonObject.get(value));

                            if (jsonObject.get(value)!=null){

                                allGEItems.get(Long.valueOf((String) value)).setBuyLimit((Long) jsonObject.get(value));

                            }else {
                                allGEItems.get(Long.valueOf((String) value)).setBuyLimit(-1);



                            }

                        }

                    }

                }
            } catch (IOException | ParseException e) {
                e.printStackTrace();
            }



        }
        allGEItems.values().forEach(s->GeItems.add(s.getItem()));
        Object[][] array2d = GeItems.toArray(new Object[GeItems.size()][]);
        return array2d;
    }


    public static Map<Long, Item> getGeItems() {
        if (allGEItems.isEmpty()){
            getAllGEItems();

        }
        return allGEItems;
    }
}

 

 

 

Id -> Image


   Image image =null;

    private void drawitem(){
        if (image ==null){

            URL url = null;

            try {
                url = new URL("https://rsbuddy.com/items/" + itemid+".png");
            } catch (MalformedURLException e) {
                e.printStackTrace();
            }

            try {
                image = ImageIO.read(url);

            } catch (IOException e) {
                e.printStackTrace();
            }

        }
        Graphics g = c.getGraphics();
        Graphics2D g2 = (Graphics2D) g;
        if (image!=null){

            g.drawImage(image, 55, 50,60,60,null );
            g.setColor(lowlites);
            g2.setStroke(new BasicStroke(3));

        }else {
            drawText("ERROR", 50 ,50,Color.white,font1);
        }
        
        g2.setStroke(new BasicStroke(1));
        g.setColor(Color.black);
        g2.draw(new RoundRectangle2D.Double(50, 50, 60, 60, 10, 10));

    }

 

 

So, you are getting item ID from osrsbox, item image from rsbuddy, if tradeable or not and G.E limits but where does the G.E price come from? Also, the item image is just the icon :( wanted to get a high quality one like this: https://oldschool.runescape.wiki/images/thumb/3/30/Abyssal_whip_detail.png/800px-Abyssal_whip_detail.png?70893

Link to comment
Share on other sites

4 hours ago, Consulti said:

So, you are getting item ID from osrsbox, item image from rsbuddy, if tradeable or not and G.E limits but where does the G.E price come from? Also, the item image is just the icon :( wanted to get a high quality one like this: https://oldschool.runescape.wiki/images/thumb/3/30/Abyssal_whip_detail.png/800px-Abyssal_whip_detail.png?70893

I can count the amount of polygones of an rs item on 1 hand why do you need 80kb images? There is around 10k items and 4k tradeable items all of those with high qualty images is between 300mb - 800. That is alot. 

Get the prices like https://services.runescape.com/m=itemdb_oldschool/api/catalogue/detail.json?item=*ID*

Link to comment
Share on other sites

1 minute ago, Nbacon said:

I can count the amount of polygones of an rs item on 1 hand why do you need 80kb images? There is around 10k items and 4k tradeable items all of those with high qualty images is between 300mb - 800. That is alot. 

Get the prices like https://services.runescape.com/m=itemdb_oldschool/api/catalogue/detail.json?item=*ID*

We wanna animate the item like zoom in/out, check specific details but for that, the image needs to be big and in HD, the icon currently offered are too small for that. The file size is not a big deal since we won't load it all at once, just the 4k tradeable item and the user would have access 1 by 1.

Thanks for the price suggestion, is https://rsbuddy.com/exchange/summary.json still reliable?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...