- INSTANT Jsoup How-to
- Pete Houston
- 789字
- 2021-08-20 16:52:35
Preface
Web services are developing advanced technologies to provide information to third parties through forms such as RSS and Atom or through web service APIs such as SOAP and REST. However, it is inevitable that you will have to scrape HTML content from websites with no built-in web services at some point in your career. That's when you should take a look and enhance your capability of web scraping using one of the most powerful Java web scraping libraries, Jsoup.
What this book covers
Getting input for parser to create an, HTML document object structure.
Extracting data using DOM from the HTML page.
Extracting data using CSS selector from the HTML page.
Transforming HTML elements to create, update, or remove contents inside elements.
Miscellaneous Jsoup options for empowering parsing ability in various ways.
Cleaning dirty HTML documents to transform malformed or buggy XSS into a well-formed document.
Listing all URLs within in an HTML page to practice the first real-world problem.
Listing all images within in an HTML page is a simple solution to crawling all images in a website.
What you need for this book
Software required: Java SDK v6 or above.
Skills required:
- Java programming
- Basic network programming
- Knowledge of HTML and DOM structure
Who this book is for
If you are a Java developer about to make your applications scrape content from some websites and don't have much of an idea on how it works, this book is definitely for you. This book is written as a step-by-step explanation; thus, even a beginner can learn and master Jsoup.
Conventions
In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.
Code words in text are shown as follows: "In HTML, the images are usually put under the <img>
tag, so the selector to query these images is img[src]
."
A block of code is set as follows:
<html> <head> <title>Section 04: Modify elements' contents</title> <body> <h1>Jsoup: the HTML parser</h1> </body> </html>
New terms and important words are shown in bold.
Note
Warnings or important notes appear in a box like this.
Tip
Tips and tricks appear like this.
Reader feedback
Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.
To send us general feedback, simply send an e-mail to <feedback@packtpub.com>
, and mention the book title via the subject of your message.
If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.
Customer support
Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.
Downloading the example code
You can download the example code files for all Packt books you have purchased from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.
Errata
Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.
Piracy
Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.
Please contact us at <copyright@packtpub.com>
with a link to the suspected pirated material.
We appreciate your help in protecting our authors, and our ability to bring you valuable content.
Questions
You can contact us at <questions@packtpub.com>
if you are having a problem with any aspect of the book, and we will do our best to address it.
- Vue.js 2 and Bootstrap 4 Web Development
- 云計(jì)算通俗講義(第3版)
- Node.js 12實(shí)戰(zhàn)
- 軟件工程基礎(chǔ)與實(shí)訓(xùn)教程
- 官方 Scratch 3.0 編程趣味卡:讓孩子們愛上編程(全彩)
- Xamarin Cross-Platform Development Cookbook
- Android技術(shù)內(nèi)幕(系統(tǒng)卷)
- Vue.js 3.x高效前端開發(fā)(視頻教學(xué)版)
- 高質(zhì)量程序設(shè)計(jì)指南:C++/C語言
- HTML5程序設(shè)計(jì)基礎(chǔ)教程
- Python繪圖指南:分形與數(shù)據(jù)可視化(全彩)
- Natural Language Processing with Python Cookbook
- 歐姆龍PLC編程指令與梯形圖快速入門
- Python3從入門到實(shí)戰(zhàn)
- PostGIS Cookbook