Thread: GE price dumper // rswiki

Page 1 of 2 12 LastLast
Results 1 to 10 of 13
  1. #1 GE price dumper // rswiki 
    Respected Member


    George's Avatar
    Join Date
    Mar 2009
    Posts
    7,099
    Thanks given
    2,226
    Thanks received
    3,146
    Rep Power
    5000
    No problemo, works well with item price checker and such, or say if you're using an earning potential system and has to determime players EP drop from wealth carried.

    Code:
    package server.cache.tools;
    
    import java.io.BufferedReader;
    import java.io.BufferedWriter;
    import java.io.FileNotFoundException;
    import java.io.FileWriter;
    import java.io.IOException;
    import java.io.InputStreamReader;
    import java.net.URL;
    import java.net.URLConnection;
    
    import server.cache.definitions.ItemDef;
    
    /**
     * 
     * @author http://www.rune-server.org/members/deadpool/ / Jack
     *
     */
    public class GEPRiceDumper {
    
    	public static void main(String[] args) {
    		ItemDef.unpackConfig();
    		dumpBonuses(13223);
    	}
    
    	public static void dumpBonuses(int totalItems) {
    		for (int i = 0; i < totalItems; i++) {
    			ItemDef item = ItemDef.forId(i);
    			URL url;
    			try {
    				try {
    					try {
    						if (item.name.length() <= 0)
    							continue;
    						url = new URL("http://2007.runescape.wikia.com/wiki/"
    								+ item.name.replaceAll(" ", "_"));
    						URLConnection con = url.openConnection();
    						BufferedReader in = new BufferedReader(
    								new InputStreamReader(con.getInputStream()));
    						String line;
    						System.out.println("Connection to " + url + "");
    						BufferedWriter writer = new BufferedWriter(
    								new FileWriter("geprices.txt", true));
    						while ((line = in.readLine()) != null) {
    							try {
    								if (line.contains("<span id=\"GEPrice\"><span class=\"GEItem\"><span>")) {
    									line = line
    											.replace(
    													"</span></span> coins</span>",
    													"")
    											.replace(",", "")
    											.replace("</th><td>", "")
    											.replace(
    													"<span id=\"GEPrice\"><span class=\"GEItem\"><span>",
    													"");
    									if (line.contains("' not found.--></span>"))
    										continue;
    									System.out.println("Line: " + line);
    									writer.write(item.id + "	" + line);
    									writer.newLine();
    								}
    							} catch (NumberFormatException e) {
    
    							}
    						}
    						in.close();
    						writer.close();
    					} catch (NullPointerException e) {
    
    					}
    				} catch (FileNotFoundException e) {
    
    				}
    			} catch (IOException e) {
    				// TODO Auto-generated catch block
    				e.printStackTrace();
    			}
    		}
    	}
    
    }
    Attached image

    Spoiler for Spoilers!:
    Attached image
    Attached image
    Attached image
    Attached image
    Reply With Quote  
     

  2. #2  
    need java lessons
    Eclipse's Avatar
    Join Date
    Aug 2012
    Posts
    4,436
    Thanks given
    686
    Thanks received
    898
    Rep Power
    490
    Thanks for the contribution, I wont use personally but I know a lot will.

    Quote Originally Posted by jerryrocks317 View Post
    i am 14 and have my own laptop im on almost 24/7 currently creating rsps lol so please get off my thread lol
    Reply With Quote  
     

  3. #3  


    RS Wiki's Avatar
    Join Date
    Mar 2011
    Age
    29
    Posts
    9,688
    Thanks given
    1,752
    Thanks received
    3,103
    Rep Power
    5000
    I'm tired of being constantly dumped, never a good relationship
    All the best,
    Wiki




    coming soon
    Reply With Quote  
     

  4. Thankful users:


  5. #4  
    Respected Member


    George's Avatar
    Join Date
    Mar 2009
    Posts
    7,099
    Thanks given
    2,226
    Thanks received
    3,146
    Rep Power
    5000
    Just to show how this data can be used.

    Attached image

    Spoiler for Spoilers!:
    Attached image
    Attached image
    Attached image
    Attached image
    Reply With Quote  
     

  6. #5  
    Номер 1


    Leanbow's Avatar
    Join Date
    Feb 2008
    Posts
    5,895
    Thanks given
    1,564
    Thanks received
    2,624
    Rep Power
    5000
    You can get item prices of ge api
    Reply With Quote  
     

  7. Thankful user:


  8. #6  
    Respected Member


    George's Avatar
    Join Date
    Mar 2009
    Posts
    7,099
    Thanks given
    2,226
    Thanks received
    3,146
    Rep Power
    5000
    Quote Originally Posted by Leanbow View Post
    You can get item prices of ge api
    Elaborate
    Attached image

    Spoiler for Spoilers!:
    Attached image
    Attached image
    Attached image
    Attached image
    Reply With Quote  
     

  9. #7  
    Номер 1


    Leanbow's Avatar
    Join Date
    Feb 2008
    Posts
    5,895
    Thanks given
    1,564
    Thanks received
    2,624
    Rep Power
    5000
    Quote Originally Posted by Deadpool View Post
    Elaborate
    https://github.com/Joshua-F/runescape-api/
    Reply With Quote  
     

  10. Thankful user:


  11. #8  
    Registered Member
    Join Date
    Dec 2013
    Posts
    85
    Thanks given
    0
    Thanks received
    36
    Rep Power
    59
    only 1 at a time eh...
    Reply With Quote  
     

  12. #9  
    Banned GE price dumper // rswiki Market Banned


    Join Date
    Jan 2011
    Age
    26
    Posts
    3,112
    Thanks given
    1,198
    Thanks received
    1,479
    Rep Power
    0
    Quote Originally Posted by FullyCharged View Post
    only 1 at a time eh...
    Concurrent implementation of this, uses multiple threads to load the data faster (although order isn't guaranteed)

    Code:
    import java.io.BufferedReader;
    import java.io.FileWriter;
    import java.io.InputStreamReader;
    import java.net.URL;
    import java.net.URLConnection;
    import java.nio.file.Path;
    import java.nio.file.Paths;
    import java.util.Queue;
    import java.util.concurrent.ConcurrentLinkedQueue;
    import java.util.concurrent.CountDownLatch;
    import java.util.concurrent.ExecutorService;
    import java.util.concurrent.Executors;
    
    /**
     * 
     * @author http://www.rune-server.org/members/deadpool/ / Jack
     * @author lare96
     */
    public final class GEPriceDumper {
    
        private static final Queue<String> STRINGS = new ConcurrentLinkedQueue<>();
    
        public static void main(String[] args) {
            ItemDef.unpackConfig();
            dumpBonuses(13223);
        }
    
        public static void dumpBonuses(int totalItems) {
            CountDownLatch latch = new CountDownLatch(totalItems + 1);
            Path directory = Paths.get("./geprices.txt");
            ExecutorService service = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors());
            
            for (int i = 0; i < totalItems; i++) {
                ItemDef item = ItemDef.forId(i);
                if (item.name.length() <= 0)
                    continue;
                service.execute(new DumpPrice(latch, item));
            }
            latch.await();
    
            try (FileWriter fw = new FileWriter(directory.toFile())) {
                for (;;) {
                    String next = STRINGS.poll();
                    if (next == null)
                        break;
    
                    fw.write(next);
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    
        private static final class DumpPrice implements Runnable {
    
            private final CountDownLatch latch;
            private final ItemDef item;
    
            public DumpPrice(CountDownLatch latch, ItemDef item) {
                this.latch = latch;
                this.item = item;
            }
    
            @Override
            public void run() {
                try {
                    URL url = new URL("http://2007.runescape.wikia.com/wiki/" + item.name.replaceAll(" ", "_"));
                    URLConnection con = url.openConnection();
                    BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
                    String line;
                    System.out.println("Connection to " + url + "");
                    while ((line = in.readLine()) != null) {
                        try {
                            if (line.contains("<span id=\"GEPrice\"><span class=\"GEItem\"><span>")) {
                                line = line.replace("</span></span> coins</span>", "").replace(",", "").replace("</th><td>", "").replace(
                                    "<span id=\"GEPrice\"><span class=\"GEItem\"><span>", "");
                                if (line.contains("' not found.--></span>"))
                                    continue;
                                System.out.println("Line: " + line);
                                STRINGS.add(item.id + "	" + line + "\n");
                            }
                        } catch (NumberFormatException e) {
    
                        }
                    }
                    in.close();
                } catch (Exception e) {
                    e.printStackTrace();
                } finally {
                    latch.countDown();
                }
            }
        }
    }
    Reply With Quote  
     

  13. #10  
    Banned

    Join Date
    Feb 2014
    Posts
    1,204
    Thanks given
    138
    Thanks received
    450
    Rep Power
    0
    Probably will use, thanks for the contribution.
    Reply With Quote  
     

Page 1 of 2 12 LastLast

Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. Automatic Low Alch/High Alch price Dumper
    By Vastiko in forum Snippets
    Replies: 13
    Last Post: 08-28-2009, 03:39 AM
  2. GE price checker (for shops, trade, ge) 50%
    By wizzyt21 in forum Snippets
    Replies: 6
    Last Post: 03-19-2009, 02:26 PM
  3. Grand Echange Price dumper/viewer
    By Richard1992 in forum Show-off
    Replies: 12
    Last Post: 01-05-2009, 04:22 PM
  4. The GE image dumper.
    By Tzar in forum Requests
    Replies: 3
    Last Post: 11-15-2008, 12:03 PM
Tags for this Thread

View Tag Cloud

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •