Grabs item names from the marketplace, you can input a range of item IDs. Outputs the ID + Item Name to a text file.
Enjoy! Going to have different versions that also output values and stuff later on, but for now this is it.
I'll upload an exe of it in a little while!Code:import java.util.*; import java.io.*; import java.io.UnsupportedEncodingException; import org.apache.commons.lang.StringUtils; class ItemNameGrabber { public static void main(String[] args) { //Item Name Grabber //For Gaia Online //Made by 323 //Grabs item names from the market and outputs them to a text file Scanner scan = new Scanner(System.in); int startvalue; int endvalue; int current; HTTPRequest request = new HTTPRequest(); request.setURL("http://www.gaiaonline.com/"); System.out.println("ING by 323"); System.out.println("Enter Start Value:"); startvalue = scan.nextInt(); System.out.println("Enter End Value: (Don't make it too big!)"); endvalue = scan.nextInt(); System.out.println("Scanning Marketplace..."); String source = request.get(); if (source != null) { //"Grab Sources" test successful System.out.println("GS Test Successful."); System.out.println("Still Scanning Market..."); } else { System.out.println("Error: Couldn't grab page source! ABORTING."); } current = startvalue; try { PrintWriter out = new PrintWriter(new FileWriter("MarketNames.txt")); while(current < endvalue) { request.setURL("http://www.gaiaonline.com/marketplace/itemdetail/" + current); source = request.get(); String name = StringUtils.substringBetween(source, "<h2 id=\"vend_item_title\">", "</h2>"); if (name != null ) { out.println(current + ": " + name); } current++; } out.close(); } catch ( IOException error ) { System.err.println( "Error writing to output file: " + error ); } System.out.println("Finished Scanning Marketplace!"); System.out.println("Check MarketNames.txt for your output!"); } }
Results 1 to 15 of 15
Thread: 323s Item Name Grabber
- 16 Apr. 2013 11:46pm #1
- Join Date
- Apr. 2010
- Location
- When freedom is outlawed only outlaws will be free
- Posts
- 5,113
- Reputation
- 195
- LCash
- 9.87
323s Item Name Grabber
- 16 Apr. 2013 11:50pm #2
whats the point of it?
- 16 Apr. 2013 11:55pm #3
- Join Date
- Apr. 2010
- Location
- When freedom is outlawed only outlaws will be free
- Posts
- 5,113
- Reputation
- 195
- LCash
- 1.49
- 17 Apr. 2013 12:16am #4
- 17 Apr. 2013 12:20am #5
Why are you using the marketplace instead of the GSI.
Code:import requests item_id = 1404 uri = 'http://www.gaiaonline.com/chat/gsi/' post_data = {'v':'json', 'm':'[[712,[{0}]]]'.format(item_id)} item_info = requests.post(uri, params=post_data).json() print list(item_info)[0][2][0]['name']
Basically, combine all the things I've shown in my release and you can make an item scanner that can scan huge ranges within just a few seconds as opposed to minutes.
I'll throw together a quick item scanner in a second.Last edited by Tree; 17 Apr. 2013 at 12:49am.
- 17 Apr. 2013 12:46am #6
Threw this together really quickly to demonstrate how you can get huge ranges from the GSI a lot faster than the market. It's not threaded, but if you did thread it it could scan thousands of item ranges within seconds. Could have made it more compact, or done some other misc things to it but I didn't feel like it and it was a five minute job.
Edit: Update part of the code to be a bit more dynamic.
Code:import requests import json def get_item_info(start, end): uri = 'http://www.gaiaonline.com/chat/gsi' scan_range = [i for i in xrange(start, end+1)] for i in xrange(0, len(scan_range), 50): m = [json.dumps([(712, [id]) for id in scan_range[i:i+50]])] httpget = requests.get(uri, params={'v': 'json', 'm': m}) [(yield ret) for ret in httpget.json()] scan_range = None while True: try: scan_from = int(raw_input('Scan from: ')) scan_to = int(raw_input('Scan to: ')) break except: print 'Invalid number.' item_info = get_item_info(scan_from, scan_to) with open('items.txt', 'a') as file: for item in item_info: try: item_id = item[2][0]['item_id'] item_name = item[2][0]['name'] file.write('{} : {}\n'.format(item_id, item_name)) except: pass
Last edited by Tree; 17 Apr. 2013 at 01:03am.
- 17 Apr. 2013 01:02am #7
- Join Date
- Apr. 2010
- Location
- When freedom is outlawed only outlaws will be free
- Posts
- 5,113
- Reputation
- 195
- LCash
- 1.02
Huh, that's actually pretty cool. I wasn't even aware you could get marketplace data through GSI, haha. Cool though, I'm going to have to implement that.
- 17 Apr. 2013 01:05am #8
- 17 Apr. 2013 04:13pm #9
- Join Date
- Apr. 2010
- Location
- When freedom is outlawed only outlaws will be free
- Posts
- 5,113
- Reputation
- 195
- LCash
- 1.16
- 17 Apr. 2013 05:31pm #10
Threading isn't necessarily just for speed increases. It can be fairly simple to learn so you might as well try.
- 17 Apr. 2013 10:36pm #11
- 17 Apr. 2013 10:48pm #12
- Join Date
- Apr. 2010
- Location
- When freedom is outlawed only outlaws will be free
- Posts
- 5,113
- Reputation
- 195
- LCash
- 1.14
- 17 Apr. 2013 11:03pm #13
- 17 Apr. 2013 11:09pm #14
- Join Date
- Apr. 2010
- Location
- When freedom is outlawed only outlaws will be free
- Posts
- 5,113
- Reputation
- 195
- LCash
- 2.57
Oh god, memory leaks suck e_e one of the drivers on my old dell laptop has a memory leak, and the drivers are so old that they don't receive updates anymore. So, I can use the computer for two to three hours, but then it completely crashes because it doesn't even have enough memory to run explorer.exe, I hate it. I use the laptop a lot too, despite how old it is. Dell Latitude D610, 1GB RAM, Intel Centrino CPU, found in the trash on my friends College Campus.
- 07 May. 2013 01:57am #15
great!