Jump to content

Getting Item Prices


Recommended Posts

Posted

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?

Posted

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;
	}

 

Posted
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....

Posted (edited)
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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