Skip to content
View in the app

A better way to browse. Learn more.

OSBot :: 2007 OSRS Botting

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Price grabber

Featured Replies


package org.rabrg.util;

import java.io.BufferedReader;

import java.io.IOException;

import java.io.InputStreamReader;

import java.net.URL;

/**

* Grabs prices from the Zybez RuneScape 2007 marketplace.

* @author Ryan Greene

*

*/

public final class PriceGrabber {

/**

* The base of the URL used to grab prices.

*/

private static final String BASE_URL = "http://forums.zybez.net/runescape-2007-prices/api/";

/**

* Gets the price of the item with the specified name.

* @param itemName The name of the item.

* @return The price of the item.

* @throws IOException If an IOException occurs.

*/

public static Price getPrice(final String itemName) throws IOException {

try (final BufferedReader reader = new BufferedReader(new InputStreamReader(new URL(BASE_URL + itemName).openStream()))) {

String line = reader.readLine().replaceAll("" + '"', "");

int id = Integer.parseInt(line.split("id:")[1].split(",")[0]);

String name = line.split("name:")[1].split(",")[0];

String image = line.split("image:")[1].split(",")[0];

float recentHigh = Float.parseFloat(line.split("recent_high:")[1].split(",")[0]);

float recentLow = Float.parseFloat(line.split("recent_low:")[1].split(",")[0]);

float average = Float.parseFloat(line.split("average:")[1].split(",")[0]);

int highAlch = Integer.parseInt(line.split("high_alch:")[1].split(",")[0]);

return new Price(id, name, image, recentHigh, recentLow, average, highAlch);

}

}

/**

* Represents a single price of an item.

* @author Ryan Greene

*

*/

public static final class Price {

/**

* The id of the item.

*/

private final int id;

/**

* The name of the item.

*/

private final String name;

/**

* The image of the item.

*/

private final String image;

/**

* The recent high price of the item.

*/

private final float recentHigh;

/**

* The recent low price of the item.

*/

private final float recentLow;

/**

* The average price of the item.

*/

private final float average;

/**

* The high alch value of the item.

*/

private final int highAlch;

/**

* Constructs a new price.

* @param id

* @param name

* @param image

* @param recentHigh

* @param recentLow

* @param average

* @param highAlch

*/

private Price(int id, String name, String image, float recentHigh, float recentLow, float average, int highAlch) {

this.id = id;

this.name = name;

this.image = image;

this.recentHigh = recentHigh;

this.recentLow = recentLow;

this.average = average;

this.highAlch = highAlch;

}

/**

* Gets the id of the item.

* @return The id of the item.

*/

public int getId() {

return id;

}

/**

* Gets the name of the item.

* @return The name of the item.

*/

public String getName() {

return name;

}

/**

* Gets the image of the item.

* @return The image of the item.

*/

public String getImage() {

return image;

}

/**

* Gets the recent high price of the item.

* @return The recent high price of the item.

*/

public float getRecentHigh() {

return recentHigh;

}

/**

* Gets the recent low price of the item.

* @return The recent low price of the item.

*/

public float getRecentLow() {

return recentLow;

}

/**

* Gets the average price of the item.

* @return The average price of the item.

*/

public float getAverage() {

return average;

}

/**

* Gets the high alch value of the item.

* @return The high alch value of the item.

*/

public int getHighAlch() {

return highAlch;

}

}

}

Edited by Cyberus

  • Author


Price price = PriceGrabber.getPrice("Rune Axe");

Very nice! I was just about to make something like this myself but then I saw then <3!

 

edit: I guess you didn't make it? You use it like this:

Price price = PriceGrabber.getPrice("rune+axe");

Edited by Diclonius

  • Author

I did make it, and my example works.

Guest
This topic is now closed to further replies.

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.