Free Sample
+ Collection

Instant Web Scraping with Java

Starting
Ryan Mitchell

Build simple scrapers or vast armies of Java-based bots to untangle and capture the Web
$14.99
RRP $14.99
eBook

Want this title & more?

$12.99 p/month

Subscribe to PacktLib

Enjoy full and instant access to over 2000 books and videos – you’ll find everything you need to stay ahead of the curve and make sure you can always get the job done.

Book Details

ISBN 139781849696883
Paperback72 pages

About This Book

  • Learn something new in an Instant! A short, fast, focused guide delivering immediate results
  • Get your Java environment set up and running
  • Gather clean, formatted web data into your own database
  • Learn how to work around crawler-resistant websites and legally subvert security measures
  • Use built-in Java features to perform parallel processing and distributed scraping
  • Build test cases for your own websites using JUnit

Who This Book Is For

Instant Web Scraping with Java is aimed at developers who, while not necessarily familiar with Java, are at least ready to dive into the complexities of this language with simple, step-by-step instructions leading the way. It is assumed that you have at least an intermediate knowledge of HTML, some knowledge of MySQL, and access to an Internet-connected computer while doing most of the exercises (after all, scraping the Web is difficult if your code can’t get online!)

Table of Contents

Chapter 1: Instant Web Scraping with Java
How is this legal?
Setting up your Java Environment (Simple)
Writing and executing HelloWorld.java (Simple)
Writing a simple scraper (Simple)
Writing more complicated scraper (Intermediate)
Handling errors (Simple)
Writing robust, scalable code (Advanced)
Persisting data (Advanced)
Writing tests (Intermediate)
Going undercover (Intermediate)
Submitting a basic form (Advanced)
Scraping Ajax Pages (Advanced)
Faster scraping through threading (Intermediate)
Faster scraping with RMI (Advanced)

What You Will Learn

  • Set up your Java environment and work with the Eclipse IDE
  • Execute complicated web crawlers that run without intervention
  • Handle errors, documentation, and writing robust code
  • Log scraped data for later retrieval and analysis
  • Write code to test website content and functionality with the JUnit framework
  • Learn techniques for getting around website security, designed to prevent automated scraping
  • Fill and submit forms automatically
  • Use threading to run scrapers in parallel
  • Use Java’s Remote Machine Invocation to create multi-server distributed scrapers

In Detail

Java is often thought of as a stuffy enterprise language, while web scraping is the often-murky domain of scripting languages. By combining the robustness and extensibility of Java with the flexibility and power of web scraping, we can create immensely useful tools that can solve very difficult problems.

Instant Web Scraping with Java will guide you, step by step, through setting up your Java environment. You will also learn how to write simple web scrapers and distributed networks of crawlers. Throughout the book, we will provide useful tips, out-of-the-box working code, and additional resources to build expert knowledge.

Instant Web Scraping with Java will teach how to build your own web scrapers using real-world scraping examples that collect and store data from Wikipedia, public records data sites, IP address geolocation services, and more. You will learn how to run scrapers across multiple servers, run them in parallel, and subvert common methods of anti-scraper security used on modern websites. This book will also provide you with detailed step-by-step instructions, out-of-the-box working code, and expert pointers to further resources on key topics.

Instant Web Scraping with Java will show you how to view and collect any Internet data at the speed of your processor!

Authors

Read More