Want to steal your js-kit data back now? Get the source.
Keep reading if you want to learn more about getting your data if it’s hidden in Javascript and can’t be scraped.
TechCrunch enthusiastically blogged about Js-kit, which TechCrunch bills as “Web 2.0 for lazy people,” more than a year ago. The first time TechCrunch blogged about js-kit’s commenting system, and then the 2nd time, the site blogged about the ratings system.
Js-kit is great because you just paste two lines of code into your blog or website and then kapow, you have a ratings and/or commenting system with 0 money spent on coders.
But all your ratings data is hidden in a sea of javascript that cannot be easily scraped.
Imagine you’re a long-time customer of js-kit. It’s two years later. You need to do some web analytics on the ratings. You’re wondering, “How do I steal all of my data for Js-kit?”
I emailed Js-kit this past Wednesday asking them to how to access my ratings. So far no word from them.
But if you’re like me and have watched The Matrix a few too many times, and sometimes dream that you are Neo, then there’s hope for getting your data. I found an easy way to get your Js-kit data that they won’t share with you.
1) Alter your js-kit ratings code so that it has a dom id.
Js-kit ratings code looks like this:
<div class="js-kit-rating" title="" permalink=""></div><script src="http://js-kit.com/ratings.js"></script>
Change it so that it has a unique id. In this example, I use “js_stuff”:
<div id="js_stuff" class="js-kit-rating" title="" permalink=""></div><script src="http://js-kit.com/ratings.js"></script>
2) If you don’t already have it, add prototype.js to your library of scripts. We’ll need prototype’s Ajax class.
3) Create a javascript function for snagging js-kit’s rating. The gist of this function is to dump the innerhtml of the id, js_stuff, and pass it to a script that parses it and snags the ratings.
4) Create a script used for parsing the ratings and saving it to a file or database.
You can see the js-kit rating snagger in action along with source code.
One reply on “Stealing Your Js-kit Ratings for Fun and Profit with Ajax”
Thanks for writing this code and for your comments on JS-Kit. I ap ologize for the delay in responding to your inquiry about accessing ratings data. JS-Kit supports publisher & visitor access to data. We have already released an RSS feed giving publishers access to all of their Comment data (see # 10 at JS-Kit ) and are currently adding a ton of new features to the Ratings service, including an API to access the raw data. Our forthcoming user profile will offer similar access to individual users.
If you or your readers have more great ideas for new features or services or
need support in installing our Ratings, Comments, Polls, or site Navigation service please email support@js-kit.com. If you don’t receive prompt support, please contact me directly at eric at js-kit.com.
Cheers,
Eric
JS-Kit