Jump to content

Getting Item Prices


CrashBandiboob

Recommended Posts

I've tried playing around with many of the snippets in the snippet section but just can't seem to get anything working that pulls the price of an item.

What I'm trying to do (think I should be doing...) is looking up the item name or ID against the RSBuddy data (https://rsbuddy.com/exchange/summary.json) and then outputting this as an integer.

Can anyone point me in the right direction?

Link to comment
Share on other sites

Changing source and using the official osrs database.
Came across this snippet of code but can't wrap my head around it:

 

	private Optional<Integer> getPrice(int id){
	    Optional<Integer> price = Optional.empty();

	    try {
	        URL url = new URL("http://services.runescape.com/m=itemdb_oldschool/api/catalogue/detail.json?item=" + id);
	        url.openConnection().setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36");
	        url.openConnection().setUseCaches(true);
	        BufferedReader br = new BufferedReader(new InputStreamReader(url.openConnection().getInputStream()));
	        String[] data = br.readLine().replace("{", "").replace("}", "").split(",");
	        br.close();
	        price = Optional.of(Integer.parseInt(data[0].split(":")[1]));
	    } catch(Exception e){
	        e.printStackTrace();
	    }
	    return price;
	}

 

Link to comment
Share on other sites

6 minutes ago, Gunman said:

@CrashBandiboob If you didn't know OSBot API can do this it's in this section of it https://osbot.org/api/org/osbot/rs07/api/GrandExchange.html

But if you didn't wanna use the API then sorry I got no snippet for you. I think the OSBot API uses OSBuddy's GE prices.



 

Oh wow! I should really read through the API doc one of these days....

Link to comment
Share on other sites

21 hours ago, Gunman said:

@CrashBandiboob If you didn't know OSBot API can do this it's in this section of it https://osbot.org/api/org/osbot/rs07/api/GrandExchange.html

But if you didn't wanna use the API then sorry I got no snippet for you. I think the OSBot API uses OSBuddy's GE prices.
 

That only gets the price of the item your buying/selling in the grand exchange. 

edit: read post below :boge: 

Edited by FuryShark
  • Heart 1
Link to comment
Share on other sites

8 hours ago, FuryShark said:

That only gets the price of the item your buying/selling in the grand exchange. 

Not 

getGrandExchange().getOverallPrice(id of item goes here)

It will grab the GE price not what you're buying/selling it for in the GE offer slots.

Edited by Gunman
  • Heart 2
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...