I wanted to look at a list of items in my Gaia inventory, all using like HTTP wrappers, no gui or anything
Also known as, in a program, being able to click a button and have a list of every item in your inventory pop up.
How would one do this?
(Just the grabbing item names part, not the actual popping up in the program part)
I don't care what language, just give me a general idea of what I need to do, and I can probably do it in whatever language I decide to use.
Results 1 to 17 of 17
Thread: Lets say
- 13 Oct. 2012 10:42pm #1
- Join Date
- Apr. 2010
- Location
- When freedom is outlawed only outlaws will be free
- Posts
- 5,113
- Reputation
- 195
- LCash
- 984.00
Lets say
- 13 Oct. 2012 11:26pm #2
Let's not say.
- 14 Oct. 2012 12:04am #3
- Join Date
- Apr. 2010
- Location
- When freedom is outlawed only outlaws will be free
- Posts
- 5,113
- Reputation
- 195
- LCash
- 197.00
- 14 Oct. 2012 12:19am #4
1. login to gaia.
2. find request browser/client sends when items in your invo are displayed.
3. ???
4. profit.
- 14 Oct. 2012 01:07am #5
Like Int said, just log in and navigate to your inventory page, and parse the HTML to retrieve the names.
- 14 Oct. 2012 01:34am #6
- Join Date
- Apr. 2010
- Location
- When freedom is outlawed only outlaws will be free
- Posts
- 5,113
- Reputation
- 195
- LCash
- 307.00
- 14 Oct. 2012 02:12am #7
???
Parsing would be any way to acquire or format certain data. Fairly simple technique. There's libraries like BeautifulSoup for Python and other generic HTML parsing libraries available for other languages. Libraries wouldn't be necessary if you know your way around these sorts of things though.
Look into string functions in standard libraries and regular expressions.
- 14 Oct. 2012 03:39am #8
- Join Date
- Apr. 2010
- Location
- When freedom is outlawed only outlaws will be free
- Posts
- 5,113
- Reputation
- 195
- LCash
- 561.00
Well, lets pretend I have an inventory source: http://gaiaonline.com/chat/gsi/index.php?v=json&m=[[700]]
(GSI JSON ID number 700 fetches the currently logged in user's inventory)
So how would I parse that for ONLY the item names? I think I kinda sorta know, but not really.
- 14 Oct. 2012 03:42am #9
Uh, decode the JSON. You can either do this yourself or through the convenience of a library offered to you. Python has multiple JSON libraries.
You can either encode or decode something in the JSON format. In this case you would decode in order to receive a JSON object/array containing your desired results. This too is a form of parsing.
- 14 Oct. 2012 05:05pm #10
- Join Date
- Apr. 2010
- Location
- When freedom is outlawed only outlaws will be free
- Posts
- 5,113
- Reputation
- 195
- LCash
- 15.00
Welp, I searched for a JSON encoder/decoder, and the best I could find was jsoncpp, but it looks complicated as hell to add into a project (I don't use visual studio, I use Code:locks, so everything is way harder to add to it) soooo I have no idea how to add it into my project
- 14 Oct. 2012 05:09pm #11
- 14 Oct. 2012 07:38pm #12
- Join Date
- Apr. 2010
- Location
- When freedom is outlawed only outlaws will be free
- Posts
- 5,113
- Reputation
- 195
- LCash
- 283.00
- 14 Oct. 2012 07:43pm #13
Python:
PHP Code:import simplejson as json
json.dumps(['foo', {'bar': ('baz', None, 1.0, 2)}])
print json.dumps("\"foo\bar")
Blame it on the free and open source compiler why don't you. Be gone with you.Last edited by The Unintelligible; 14 Oct. 2012 at 07:59pm.
- 14 Oct. 2012 08:02pm #14
- Join Date
- Apr. 2010
- Location
- When freedom is outlawed only outlaws will be free
- Posts
- 5,113
- Reputation
- 195
- LCash
- 667.00
Oh, I thought you were saying I shouldn't be using C++ because I "don't know it well enough". While it's partly true, it's better to try to get my hands dirty and actually learn something rather than take the easy way out. And I would love to use python, but I don't know it at all and currently don't have time to learn it
- 15 Oct. 2012 06:55pm #15
You're complaining about not knowing C/C++ then you complain you don't have the time to learn python. Python should take you like 2 hours to learn the syntax. Follow this guide for style of coding python and you're all good.
PEP 8 -- Style Guide for Python Code
- 15 Oct. 2012 07:35pm #16
- Join Date
- Apr. 2010
- Location
- When freedom is outlawed only outlaws will be free
- Posts
- 5,113
- Reputation
- 195
- LCash
- 341.00
- 16 Oct. 2012 08:49pm #17
You could use regex to parse the text, but it's probably alot less efficient.
LG's resident grammar nazi.
Need warez? I can probably find it for you. Throw me a PM.
For all of my sales, if you refer a buyer to me and they make a purchase, you can recieve 5%