{"id":32,"date":"2008-02-17T18:55:36","date_gmt":"2008-02-18T02:55:36","guid":{"rendered":"http:\/\/www.codebelay.com\/blog\/?p=32"},"modified":"2008-02-17T19:17:12","modified_gmt":"2008-02-18T03:17:12","slug":"stealing-your-js-kit-ratings-for-fun-and-profit-with-ajax","status":"publish","type":"post","link":"https:\/\/www.codebelay.com\/blog\/2008\/02\/17\/stealing-your-js-kit-ratings-for-fun-and-profit-with-ajax\/","title":{"rendered":"Stealing Your Js-kit Ratings for Fun and Profit with Ajax"},"content":{"rendered":"<p>Want to steal your js-kit data back now? <a href=\"http:\/\/www.codebelay.com\/getjskitratings\/\">Get the source<\/a>.<\/p>\n<p>Keep reading if you want to learn more about getting your data if it&#8217;s hidden in Javascript and can&#8217;t be scraped.<\/p>\n<p><a href=\"http:\/\/www.techcrunch.com\/2006\/11\/29\/quick-embed-code-to-add-comments-to-any-site\/\">TechCrunch enthusiastically blogged about Js-kit<\/a>, which TechCrunch bills as &#8220;<a href=\"http:\/\/www.techcrunch.com\/2007\/04\/23\/js-kit-web-2-for-lazy-people\/\">Web 2.0 for lazy people<\/a>,&#8221; more than a year ago. The first time TechCrunch blogged about js-kit&#8217;s commenting system, and then the 2nd time, the site blogged about the ratings system.<\/p>\n<p><a href=\"http:\/\/js-kit.com\/\">Js-kit is great<\/a> 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.<\/p>\n<p>But all your ratings data is hidden in a sea of javascript that cannot be easily scraped.<\/p>\n<p>Imagine you&#8217;re a long-time customer of js-kit. It&#8217;s two years later. You need to do some web analytics on the ratings. You&#8217;re wondering, &#8220;How do I steal all of my data for Js-kit?&#8221;<\/p>\n<p>I emailed Js-kit this past Wednesday asking them to how to access <b>my ratings<\/b>. So far no word from them.<\/p>\n<p>But if you&#8217;re like me and have watched The Matrix a few too many times, and sometimes dream that you are Neo, then there&#8217;s hope for getting your data. I found an easy way to get your Js-kit data that they won&#8217;t share with you.<\/p>\n<p><strong>1) Alter your js-kit ratings code so that it has a dom id.<\/strong><\/p>\n<p>Js-kit ratings code looks like this:<br \/>\n&lt;div class=&quot;js-kit-rating&quot; title=&quot;&quot; permalink=&quot;&quot;&gt;&lt;\/div&gt;&lt;script src=&quot;http:\/\/js-kit.com\/ratings.js&quot;&gt;&lt;\/script&gt;<\/p>\n<p>Change it so that it has a unique id. In this example, I use &#8220;js_stuff&#8221;:<br \/>\n&lt;div id=&quot;js_stuff&quot; class=&quot;js-kit-rating&quot; title=&quot;&quot; permalink=&quot;&quot;&gt;&lt;\/div&gt;&lt;script src=&quot;http:\/\/js-kit.com\/ratings.js&quot;&gt;&lt;\/script&gt;<\/p>\n<p><strong>2) If you don&#8217;t already have it, <a href=\"http:\/\/www.prototypejs.org\/\">add prototype.js to your library of scripts<\/a>.<\/strong> We&#8217;ll need prototype&#8217;s Ajax class.<\/p>\n<p><strong>3) Create a javascript function for snagging js-kit&#8217;s rating.<\/strong> 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.<\/p>\n<p><strong>4) Create a script used for parsing the ratings and saving it to a file or database.<\/strong><\/p>\n<p>You can <a href=\"http:\/\/www.codebelay.com\/getjskitratings\/\">see the js-kit rating snagger<\/a> in action along with source code.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I found an easy way to get your Js-kit data that they won&#8217;t share with you.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,5],"tags":[],"class_list":["post-32","post","type-post","status-publish","format-standard","hentry","category-how-to","category-techbiz"],"_links":{"self":[{"href":"https:\/\/www.codebelay.com\/blog\/wp-json\/wp\/v2\/posts\/32","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.codebelay.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.codebelay.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.codebelay.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.codebelay.com\/blog\/wp-json\/wp\/v2\/comments?post=32"}],"version-history":[{"count":0,"href":"https:\/\/www.codebelay.com\/blog\/wp-json\/wp\/v2\/posts\/32\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.codebelay.com\/blog\/wp-json\/wp\/v2\/media?parent=32"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.codebelay.com\/blog\/wp-json\/wp\/v2\/categories?post=32"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.codebelay.com\/blog\/wp-json\/wp\/v2\/tags?post=32"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}