Build simple scrapers or vast armies of Java-based bots to untangle and capture the Web
- 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
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!
What you will learn from this book
- 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
Filled with practical, step-by-step instructions and clear explanations for the most important and useful tasks. This book is full of short, concise recipes to learn a variety of useful web scraping techniques using Java. You will start with a simple basic recipe of setting up your Java environment and gradually learn some more advanced recipes such as using complex Scrapers.
Who this book is written 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!)