I’m just getting my ass kicked by Ruby tonight so I don’t have much to show. Trying to just get my metadata scraping to output something currently looks like this:
Really ugly code that still doesn’t work. My biggest problem with Ruby is that I don’t have very good debugging tools and that frustrates the shit out of me. I’m so used to the visual debuggers in the Chrome Dev tools that doing everything with p or puts is just soul-crushing.
Right now my biggest problem is that data isn’t being returned from the spider for whatever reason. This is especially annoying because the operation takes a while to run… I should slim it down but my brain is too tired to re-write the code. I’m kind of hoping for a lucky break. Advice to anyone just starting out in programming, do not do exactly what I’m doing right now.
Ok so after getting my ass totally handed to me by Ruby here’s a working version of the spider that grabs the proper metadata.
I had to comment out the Tentacles::SelectionError because it was throwing and saying it wasn’t getting any content with a selector even though it was. Not sure wtf is going on there but I’m sure it has to do with the fact that it’s 1:30 a.m. I have a rule that nothing good happens after 11pm when it comes to coding. Tonight has lived up to that. Anyway the above should put out a hash which when converted to JSON looks like this:
I’m pretty certain I could have done this with Node in a fraction of the time if only because Node is much easier to debug with Chrome Dev tools using node-inspector. While I love the Ruby language I definitely do not like debugging it…
Tomorrow I might write some JS to give my brain a break. I’m thoroughly pissed off at Ruby for the evening. - Rob