Chapter 6. Giving Back to the World

Hack 101. Hacks #94-100

The concept of leeching has been with us since day one, from the original land squatters, to rude time sharers in college computer labs, to BBS hogs who tied up the server’s only phone line. The concept is strictly “the tragedy of the commons”: most people just won’t give back the resources they take. In this chapter, we’ll discuss how we can use our scraping skills for the good of others.

The up-and-coming most popular way of providing your data to the world is through the use of application programming interfaces (APIs). Much like you can call LWP::Simple’s get function [Hack #9] without having to worry about creating network sockets and following HTTP protocols, an API to your data allows visitors to get the information they desire quickly and simply. In essence, you’re removing the need for them to scrape and spider your site.

Arguably, Internet APIs hit the true mainstream when Google announced one for its entire database (http://api.google.com). After a few tentative steps, use of the API exploded and Google Hacks, dedicated to teaching, exploring, and exploiting the technology, became a New York Times best seller.

More APIs quickly followed, the second big announcement coming from Amazon.com (http://www.amazon.com/webservices/). There was no hesitation: Google had broken the ice, and developers flocked to the Amazon.com Web Services API, quickly creating libraries, shopping-cart builders, plug-ins for weblog software ...

Get Spidering Hacks now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.