Page 1 of 1

Shop Analyzing Help

Posted: Mon Dec 07, 2015 5:55 am
by EmberCelica
Im not quite sure what im doing wrong. I log in successfully, based on the logs. But everything comes to a complete halt when i get to here:

Code: Select all

var doc = XmlService.parse(html)
all the code before is just the login code which i can see works, becuase i return the full html, with the discount, player name, and etc when i do this:

Code: Select all

  var html = UrlFetchApp.fetch(shopurl,options).getContentText();
  Logger.log(html)
and it will not get passed the xml.
I looked at alot of pages involving parsing HTML and that is how they were saying to do it, with a few other things.
Every time it errors it returns this:
Error on line 133: The element type "meta" must be terminated by the matching end-tag "</meta>". (line 9, file "Shop Analyzer")
Which i presume, is a meta tag that isnt closed. I do not expect anything as far as editing the HTML, but i was wondering if there is a way to work around this while still parsing the code. Its giving me a headache really, and i kinda wanna make some progress on this.
PS: the "Line 9, file shop analyzer" is my script, line 133 is your html btw.

If it wasnt for the fact it lies outside of my code, i would most liekly be able to solve it, but this way its faster.

Re: Shop Analyzing Help

Posted: Mon Dec 07, 2015 6:40 am
by Pri
What parts of the shop page are you wanting to parse?

Re: Shop Analyzing Help

Posted: Mon Dec 07, 2015 7:15 am
by EmberCelica
I was wanting to parse the Items, in addition to who bought what in the shop, from member rank, to ice, to spawners, to heads. All of that. In the end i was going to plug the numbers into a spreadsheet and analyze it.

Re: Shop Analyzing Help

Posted: Mon Dec 07, 2015 2:23 pm
by Pri
I don't know if our shop as it is right now would work with the kind of parsing that Google offers. We don't have an API for the shop data either at this time but I may consider one if there is interest from the players for it.

If I was going to parse our page right now the way it is I'd probably use regex on specific class names and then store those, but this is me thinking about PHP, you can use regex with other languages though like Javascript.

Re: Shop Analyzing Help

Posted: Mon Dec 07, 2015 3:56 pm
by EmberCelica
Alright i will see if javascript integration with google scripts is possible, thank you for letting me know pri, and please do let me know if an API comes out lol.

Re: Shop Analyzing Help

Posted: Mon Dec 14, 2015 5:11 am
by EmberCelica
Forgot to post this, but thank you for the information and thank you jack, yet again, for giving me a few pointers, namely directing me towards python in this instance. The program is complete, and works, but could be improved upon, so until then i will not disclose code. I plan to modify it to write to a spreadsheet for easier reading since i have it writing to a log located in a psuedo-dynamic filepath, timestamped to the day.