eensyweensy

a poor man's webspider
git clone https://wehaveforgeathome.hates.computer/eensyweensy.git
Log | Files | Refs | LICENSE

commit dcc47c63091b43b9862fad0d8e6f16c97879ed7e
parent d75305f06b7313c5ce81c83a7a9b58a8e5f5eb4f
Author: Ryan Wolf <rwolf@borderstylo.com>
Date:   Mon, 22 Feb 2010 14:09:39 -0800

moved license, added go()

Diffstat:
ALICENSE | 11+++++++++++
Meensyweensy.user.js | 59+++++++++++------------------------------------------------
2 files changed, 22 insertions(+), 48 deletions(-)

diff --git a/LICENSE b/LICENSE @@ -0,0 +1,11 @@ + Tumbolia Public License + +Copyright 2010, Ryan Wolf <rwolf@borderstylo.com> + +Copying and distribution of this file, with or without modification, are +permitted in any medium without royalty provided the copyright notice and this +notice are preserved. + +TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. opan saurce LOL diff --git a/eensyweensy.user.js b/eensyweensy.user.js @@ -3,17 +3,10 @@ // @namespace example.com // @include http://borderstylo.com/posts* // ==/UserScript== -/* -Copyright 2010, Ryan Wolf - -Copying and distribution of this file, with or without modification, are -permitted in any medium without royalty provided the copyright notice and -this notice are preserved. - -TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. opan saurce LOL -*/ +// Copyright 2010 Ryan Wolf +// +// This file is part of eensyweensy and is released under the +// Tumbolia Public License. See LICENSE for more details. var Spider = function () { this.jquery = 'http://jquery.com/src/jquery-latest.js'; @@ -23,15 +16,12 @@ var Spider = function () { return data; }; }; - Spider.prototype.insert_jquery = function () { /* source: http://joanpiedra.com/jquery/greasemonkey/ */ - // Add jQuery var GM_JQ = doc.createElement('script'); GM_JQ.src = this.; GM_JQ.type = 'text/javascript'; document.getElementsByTagName('head')[0].appendChild(GM_JQ); - // Check if jQuery's loaded var that = this; function GM_wait () { if (typeof unsafeWindow.jQuery == 'undefined') { @@ -39,18 +29,15 @@ Spider.prototype.insert_jquery = function () { } else { that.$ = unsafeWindow.jQuery; - // here we call our function that.grab_data(); } } GM_wait(); }; - Spider.prototype.grab_data = function ($) { var data = this.grabber(that.$); this.phone_home(data); }; - Spider.prototype.phone_home = function (data) { /* source: http://diveintogreasemonkey.org/api/gm_xmlhttprequest.html */ GM_xmlhttpRequest({ @@ -60,51 +47,27 @@ Spider.prototype.phone_home = function (data) { onload: this.handle_results, }); }; - Spider.prototype.handle_results = function (response) { alert(response.responseText); }; +Spider.prototype.go = function () { + this.insert_jquery(); +}; /* our fun starts here */ var spider = new Spider(); spider.home = 'http://localhost/borderstylo_grabber.php' spider.grabber = function ($) { -}; -spider.go(); - - - - - - - - - - - - - - - - - - - - -function scrape_page () { var urls = []; $('.post-footer > a:nth-child(2)').each(function (i, node) { urls.push(node.href); }); var next_page_button = $('.next_page'); var on_last_page = next_page_button.hasClass('disabled'); - var results = { + var data = { urls: urls, on_last_page: on_last_page, }; - alert(JSON.stringify(results)); - //phone_home(results); -} - -function phone_home (results) { -} + return data; +}; +spider.go();